mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user