feat(forms): added touched and untouched to Control

This commit is contained in:
vsavkin
2015-06-02 08:41:33 -07:00
parent f303f0c17a
commit ec3a78289f
8 changed files with 66 additions and 11 deletions
+8
View File
@@ -30,6 +30,7 @@ export class AbstractControl {
_status: string;
_errors: StringMap<string, any>;
_pristine: boolean;
_touched: boolean;
_parent: any; /* ControlGroup | ControlArray */
validator: Function;
@@ -38,6 +39,7 @@ export class AbstractControl {
constructor(validator: Function) {
this.validator = validator;
this._pristine = true;
this._touched = false;
}
get value(): any { return this._value; }
@@ -52,8 +54,14 @@ export class AbstractControl {
get dirty(): boolean { return !this.pristine; }
get touched(): boolean { return this._touched; }
get untouched(): boolean { return !this._touched; }
get valueChanges(): Observable { return this._valueChanges; }
touch(): void { this._touched = true; }
setParent(parent) { this._parent = parent; }
updateValidity({onlySelf}: {onlySelf?: boolean} = {}): void {