Merge remote-tracking branch 'origin/master'

This commit is contained in:
Adam Bradley
2015-07-03 13:51:38 -05:00
2 changed files with 2 additions and 45 deletions

View File

@ -7,7 +7,7 @@ import {IonicView} from 'ionic/ionic';
@IonicView({
templateUrl: 'main.html'
})
class IonicApp {
class MyApp {
constructor() {
console.log('IonicApp Start')
}
@ -17,5 +17,5 @@ class IonicApp {
}
export function main(ionicBootstrap) {
ionicBootstrap(IonicApp);
ionicBootstrap(MyApp);
}

View File

@ -193,46 +193,3 @@ export class SegmentButton {
}
}
@IonicDirective({
selector: 'ion-segment',
host: {
'(change)': 'onChange($event.target.value)',
'(input)': 'onChange($event.target.value)',
'(blur)': 'onTouched()',
'[value]': 'value',
'[class.ng-untouched]': 'cd.control?.untouched == true',
'[class.ng-touched]': 'cd.control?.touched == true',
'[class.ng-pristine]': 'cd.control?.pristine == true',
'[class.ng-dirty]': 'cd.control?.dirty == true',
'[class.ng-valid]': 'cd.control?.valid == true',
'[class.ng-invalid]': 'cd.control?.valid == false'
}
})
export class SegmentControlValueAccessor {
constructor(cd: NgControl, renderer: Renderer, elementRef: ElementRef, segment: Segment) {
this.onChange = (_) => {};
this.onTouched = (_) => {};
this.cd = cd;
this.renderer = renderer;
this.elementRef = elementRef;
this.segment = segment;
cd.valueAccessor = this;
}
writeValue(value) {
// both this.value and setProperty are required at the moment
// remove when a proper imperative API is provided
this.value = !value ? '' : value;
this.renderer.setElementProperty(this.elementRef.parentView.render, this.elementRef.boundElementIndex, 'value', this.value);
this.segment.value = this.value;
this.segment.selectFromValue(value);
}
registerOnChange(fn) { this.onChange = fn; }
registerOnTouched(fn) { this.onTouched = fn; }
}