fix(forms): update dirty before emitting value change (#10362)
Closes #5328
This commit is contained in:
@@ -45,8 +45,8 @@ export function setUpControl(control: FormControl, dir: NgControl): void {
|
||||
// view -> model
|
||||
dir.valueAccessor.registerOnChange((newValue: any) => {
|
||||
dir.viewToModelUpdate(newValue);
|
||||
control.updateValue(newValue, {emitModelToViewChange: false});
|
||||
control.markAsDirty();
|
||||
control.updateValue(newValue, {emitModelToViewChange: false});
|
||||
});
|
||||
|
||||
control.registerOnChange((newValue: any, emitModelEvent: boolean) => {
|
||||
|
||||
@@ -409,9 +409,9 @@ export class FormControl extends AbstractControl {
|
||||
}
|
||||
|
||||
reset(value: any = null, {onlySelf}: {onlySelf?: boolean} = {}): void {
|
||||
this.updateValue(value, {onlySelf: onlySelf});
|
||||
this.markAsPristine({onlySelf: onlySelf});
|
||||
this.markAsUntouched({onlySelf: onlySelf});
|
||||
this.updateValue(value, {onlySelf: onlySelf});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user