refactor(LifecycleEvent): change from onInit to Lifecycle.onInit
BREAKING CHANGE Closes #2928
This commit is contained in:

committed by
Tobias Bosch

parent
e1e7912ab2
commit
b73ba68215
@ -1,4 +1,4 @@
|
||||
import {Directive, onDestroy, onInit} from 'angular2/annotations';
|
||||
import {Directive, LifecycleEvent} from 'angular2/angular2';
|
||||
import {Inject, Ancestor, forwardRef, Binding} from 'angular2/di';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
@ -52,7 +52,7 @@ const controlGroupBinding =
|
||||
selector: '[ng-control-group]',
|
||||
hostInjector: [controlGroupBinding],
|
||||
properties: ['name: ng-control-group'],
|
||||
lifecycle: [onInit, onDestroy],
|
||||
lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy],
|
||||
exportAs: 'form'
|
||||
})
|
||||
export class NgControlGroup extends ControlContainer {
|
||||
@ -71,4 +71,4 @@ export class NgControlGroup extends ControlContainer {
|
||||
get path(): List<string> { return controlPath(this.name, this._parent); }
|
||||
|
||||
get formDirective(): Form { return this._parent.formDirective; }
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {List, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
|
||||
import {QueryList} from 'angular2/core';
|
||||
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
|
||||
import {forwardRef, Ancestor, Binding, Inject} from 'angular2/di';
|
||||
|
||||
import {ControlContainer} from './control_container';
|
||||
@ -76,7 +75,7 @@ const controlNameBinding =
|
||||
hostInjector: [controlNameBinding],
|
||||
properties: ['name: ngControl', 'model: ngModel'],
|
||||
events: ['update: ngModel'],
|
||||
lifecycle: [onDestroy, onChange],
|
||||
lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange],
|
||||
exportAs: 'form'
|
||||
})
|
||||
export class NgControlName extends NgControl {
|
||||
@ -115,4 +114,4 @@ export class NgControlName extends NgControl {
|
||||
get control(): Control { return this.formDirective.getControl(this); }
|
||||
|
||||
get validator(): Function { return composeNgValidator(this.ngValidators); }
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
import {Directive, Query, onChange} from 'angular2/annotations';
|
||||
import {QueryList} from 'angular2/core';
|
||||
import {Directive, LifecycleEvent, Query, QueryList} from 'angular2/angular2';
|
||||
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
||||
|
||||
import {NgControl} from './ng_control';
|
||||
@ -64,7 +63,7 @@ const formControlBinding =
|
||||
hostInjector: [formControlBinding],
|
||||
properties: ['form: ngFormControl', 'model: ngModel'],
|
||||
events: ['update: ngModel'],
|
||||
lifecycle: [onChange],
|
||||
lifecycle: [LifecycleEvent.onChange],
|
||||
exportAs: 'form'
|
||||
})
|
||||
export class NgFormControl extends NgControl {
|
||||
|
@ -2,7 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
|
||||
|
||||
import {Directive, onChange} from 'angular2/annotations';
|
||||
import {Directive, LifecycleEvent} from 'angular2/angular2';
|
||||
import {forwardRef, Binding} from 'angular2/di';
|
||||
import {NgControl} from './ng_control';
|
||||
import {NgControlGroup} from './ng_control_group';
|
||||
@ -84,7 +84,7 @@ const formDirectiveBinding =
|
||||
selector: '[ng-form-model]',
|
||||
hostInjector: [formDirectiveBinding],
|
||||
properties: ['form: ng-form-model'],
|
||||
lifecycle: [onChange],
|
||||
lifecycle: [LifecycleEvent.onChange],
|
||||
host: {
|
||||
'(submit)': 'onSubmit()',
|
||||
},
|
||||
|
@ -2,8 +2,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Directive, Query, onChange} from 'angular2/annotations';
|
||||
import {QueryList} from 'angular2/core';
|
||||
import {Directive, LifecycleEvent, QueryList, Query} from 'angular2/angular2';
|
||||
import {forwardRef, Ancestor, Binding} from 'angular2/di';
|
||||
|
||||
import {NgControl} from './ng_control';
|
||||
@ -34,7 +33,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
|
||||
hostInjector: [formControlBinding],
|
||||
properties: ['model: ngModel'],
|
||||
events: ['update: ngModel'],
|
||||
lifecycle: [onChange],
|
||||
lifecycle: [LifecycleEvent.onChange],
|
||||
exportAs: 'form'
|
||||
})
|
||||
export class NgModel extends NgControl {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {Renderer} from 'angular2/render';
|
||||
import {ElementRef, QueryList} from 'angular2/core';
|
||||
import {Directive, Query, onDestroy, onChange} from 'angular2/annotations';
|
||||
import {ElementRef, QueryList, Directive, Query} from 'angular2/angular2';
|
||||
|
||||
import {NgControl} from './ng_control';
|
||||
import {ControlValueAccessor} from './control_value_accessor';
|
||||
|
Reference in New Issue
Block a user