diff --git a/modules/angular2/src/common/forms/directives/ng_control_group.ts b/modules/angular2/src/common/forms/directives/ng_control_group.ts index 63e6eab718..310b8cd167 100644 --- a/modules/angular2/src/common/forms/directives/ng_control_group.ts +++ b/modules/angular2/src/common/forms/directives/ng_control_group.ts @@ -7,7 +7,8 @@ import { Host, SkipSelf, forwardRef, - Provider + Provider, + Self } from 'angular2/core'; import {CONST_EXPR} from 'angular2/src/facade/lang'; @@ -80,8 +81,8 @@ export class NgControlGroup extends ControlContainer implements OnInit, _parent: ControlContainer; constructor(@Host() @SkipSelf() parent: ControlContainer, - @Optional() @Inject(NG_VALIDATORS) private _validators: any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[]) { + @Optional() @Self() @Inject(NG_VALIDATORS) private _validators: any[], + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[]) { super(); this._parent = parent; } diff --git a/modules/angular2/src/common/forms/directives/ng_control_name.ts b/modules/angular2/src/common/forms/directives/ng_control_name.ts index 85ac9b8a74..31df287534 100644 --- a/modules/angular2/src/common/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/common/forms/directives/ng_control_name.ts @@ -12,7 +12,8 @@ import { SkipSelf, Provider, Inject, - Optional + Optional, + Self } from 'angular2/core'; import {ControlContainer} from './control_container'; @@ -103,11 +104,12 @@ export class NgControlName extends NgControl implements OnChanges, private _added = false; constructor(@Host() @SkipSelf() private _parent: ControlContainer, - @Optional() @Inject(NG_VALIDATORS) private _validators: + @Optional() @Self() @Inject(NG_VALIDATORS) private _validators: /* Array */ any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: /* Array */ any[], - @Optional() @Inject(NG_VALUE_ACCESSOR) valueAccessors: ControlValueAccessor[]) { + @Optional() @Self() @Inject(NG_VALUE_ACCESSOR) + valueAccessors: ControlValueAccessor[]) { super(); this.valueAccessor = selectValueAccessor(this, valueAccessors); } diff --git a/modules/angular2/src/common/forms/directives/ng_form.ts b/modules/angular2/src/common/forms/directives/ng_form.ts index 0dc8103f7d..eefa78c328 100644 --- a/modules/angular2/src/common/forms/directives/ng_form.ts +++ b/modules/angular2/src/common/forms/directives/ng_form.ts @@ -6,7 +6,7 @@ import { } from 'angular2/src/facade/async'; import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection'; import {isPresent, isBlank, CONST_EXPR} from 'angular2/src/facade/lang'; -import {Directive, forwardRef, Provider, Optional, Inject} from 'angular2/core'; +import {Directive, forwardRef, Provider, Optional, Inject, Self} from 'angular2/core'; import {NgControl} from './ng_control'; import {Form} from './form_interface'; import {NgControlGroup} from './ng_control_group'; @@ -90,8 +90,8 @@ export class NgForm extends ControlContainer implements Form { form: ControlGroup; ngSubmit = new EventEmitter(); - constructor(@Optional() @Inject(NG_VALIDATORS) validators: any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]) { + constructor(@Optional() @Self() @Inject(NG_VALIDATORS) validators: any[], + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]) { super(); this.form = new ControlGroup({}, null, composeValidators(validators), composeAsyncValidators(asyncValidators)); diff --git a/modules/angular2/src/common/forms/directives/ng_form_control.ts b/modules/angular2/src/common/forms/directives/ng_form_control.ts index 73bc2000b9..75f0f6c3d6 100644 --- a/modules/angular2/src/common/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/common/forms/directives/ng_form_control.ts @@ -9,7 +9,8 @@ import { forwardRef, Provider, Inject, - Optional + Optional, + Self } from 'angular2/core'; import {NgControl} from './ng_control'; import {Control} from '../model'; @@ -86,11 +87,12 @@ export class NgFormControl extends NgControl implements OnChanges { model: any; viewModel: any; - constructor(@Optional() @Inject(NG_VALIDATORS) private _validators: + constructor(@Optional() @Self() @Inject(NG_VALIDATORS) private _validators: /* Array */ any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: /* Array */ any[], - @Optional() @Inject(NG_VALUE_ACCESSOR) valueAccessors: ControlValueAccessor[]) { + @Optional() @Self() @Inject(NG_VALUE_ACCESSOR) + valueAccessors: ControlValueAccessor[]) { super(); this.valueAccessor = selectValueAccessor(this, valueAccessors); } diff --git a/modules/angular2/src/common/forms/directives/ng_form_model.ts b/modules/angular2/src/common/forms/directives/ng_form_model.ts index cef2888eeb..a766f8a323 100644 --- a/modules/angular2/src/common/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/common/forms/directives/ng_form_model.ts @@ -8,7 +8,8 @@ import { forwardRef, Provider, Inject, - Optional + Optional, + Self } from 'angular2/core'; import {NgControl} from './ng_control'; import {NgControlGroup} from './ng_control_group'; @@ -107,8 +108,8 @@ export class NgFormModel extends ControlContainer implements Form, directives: NgControl[] = []; ngSubmit = new EventEmitter(); - constructor(@Optional() @Inject(NG_VALIDATORS) private _validators: any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[]) { + constructor(@Optional() @Self() @Inject(NG_VALIDATORS) private _validators: any[], + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[]) { super(); } diff --git a/modules/angular2/src/common/forms/directives/ng_model.ts b/modules/angular2/src/common/forms/directives/ng_model.ts index 123f159832..6119cc23a4 100644 --- a/modules/angular2/src/common/forms/directives/ng_model.ts +++ b/modules/angular2/src/common/forms/directives/ng_model.ts @@ -8,7 +8,8 @@ import { forwardRef, Provider, Inject, - Optional + Optional, + Self } from 'angular2/core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor'; import {NgControl} from './ng_control'; @@ -62,9 +63,10 @@ export class NgModel extends NgControl implements OnChanges { model: any; viewModel: any; - constructor(@Optional() @Inject(NG_VALIDATORS) private _validators: any[], - @Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[], - @Optional() @Inject(NG_VALUE_ACCESSOR) valueAccessors: ControlValueAccessor[]) { + constructor(@Optional() @Self() @Inject(NG_VALIDATORS) private _validators: any[], + @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: any[], + @Optional() @Self() @Inject(NG_VALUE_ACCESSOR) + valueAccessors: ControlValueAccessor[]) { super(); this.valueAccessor = selectValueAccessor(this, valueAccessors); }