diff --git a/modules/angular2/src/forms/directives/ng_model.ts b/modules/angular2/src/forms/directives/ng_model.ts index 14072b9647..d000c80e42 100644 --- a/modules/angular2/src/forms/directives/ng_model.ts +++ b/modules/angular2/src/forms/directives/ng_model.ts @@ -38,30 +38,25 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe exportAs: 'form' }) export class NgModel extends NgControl { - control: Control; - ngModel: EventEmitter; + _control = new Control(""); + _added = false; + ngModel = new EventEmitter(); model: any; - _added: boolean; - - constructor() { - super(); - this.control = new Control(""); - this.ngModel = new EventEmitter(); - this._added = false; - } onChange(c) { if (!this._added) { - setUpControl(this.control, this); + setUpControl(this._control, this); this.control.updateValidity(); this._added = true; }; if (StringMapWrapper.contains(c, "model")) { - this.control.updateValue(this.model); + this._control.updateValue(this.model); } } + get control() { return this._control; } + get path(): List { return []; } viewToModelUpdate(newValue: any): void { ObservableWrapper.callNext(this.ngModel, newValue); }