fix(forms): mark control containers as touched when child controls are touched (#9735)

This commit is contained in:
Kara
2016-07-01 15:36:04 -07:00
committed by GitHub
parent 5eca6e4e40
commit 77dc6ef411
3 changed files with 66 additions and 7 deletions
+8 -1
View File
@@ -120,7 +120,14 @@ export abstract class AbstractControl {
clearValidators(): void { this.validator = null; }
markAsTouched(): void { this._touched = true; }
markAsTouched({onlySelf}: {onlySelf?: boolean} = {}): void {
onlySelf = normalizeBool(onlySelf);
this._touched = true;
if (isPresent(this._parent) && !onlySelf) {
this._parent.markAsTouched({onlySelf: onlySelf});
}
}
markAsDirty({onlySelf}: {onlySelf?: boolean} = {}): void {
onlySelf = normalizeBool(onlySelf);