This commit is contained in:
Max Lynch
2015-07-03 13:39:11 -05:00
parent 6ab57f916d
commit eaf6746034
4 changed files with 2 additions and 66 deletions

View File

@ -1,21 +0,0 @@
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
import {IonicView} from 'ionic/ionic';
@Component({ selector: 'ion-app' })
@IonicView({
templateUrl: 'main.html'
})
class IonicApp {
constructor() {
console.log('IonicApp Start')
}
doRefresh() {
console.log('DOREFRESH')
}
}
export function main(ionicBootstrap) {
ionicBootstrap(IonicApp);
}

View File

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