Make pristine Angular form control dirty [duplicate] Make pristine Angular form control dirty [duplicate] typescript typescript

Make pristine Angular form control dirty [duplicate]


Each instance of formControl has markAsDirty() and markAsPristine() methods (inherited from AbstractControl), so, you should be able to run

this.form.controls.foo.markAsPristine()

or better, using reactive forms API:

this.form.get('foo').markAsPristine()

or even

this.form.markAsPristine()

the same may be done with markAsDirty() method