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);
}
}
}