-
-
Save girokon/3fd12aad4e8f89e9bd5d4096ac7a5481 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstrac class Base { | |
markAllDirty(control: AbstractControl) { | |
if (control.hasOwnProperty('controls')) { | |
control.markAsDirty(true); // mark group | |
let ctrl = <any>control; | |
for (let inner in ctrl.controls) { | |
this.markAllDirty(ctrl.controls[inner] as AbstractControl); | |
} | |
} | |
else { | |
(<FormControl>(control)).markAsDirty(true); | |
} | |
} | |
markAllPrestineAndUntouched(control: AbstractControl) { | |
if (control.hasOwnProperty('controls')) { | |
control.markAsPristine(true); // mark group | |
control.markAsUntouched(true); // mark group | |
let ctrl = <any>control; | |
for (let inner in ctrl.controls) { | |
this.markAllPrestineAndUntouched(ctrl.controls[inner] as AbstractControl); | |
} | |
} | |
else { | |
(<FormControl>(control)).markAsPristine(true); | |
(<FormControl>(control)).markAsUntouched(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment