I need to avoid firing a valueChange after executing a form.reset
userForm: FormGroup;
this.userForm.reset({ emitEvent: false });
private roleValueChanges() {
this.userForm.controls.role.valueChanges.subscribe(roleId => {
this.rolesService.get(roleId);
}
}
Despite of emitEvent: false, when .reset the form, the valueChange is being fired. Any idea to avoid it?
I found this solution that works for me:
Object.keys(this.userForm.controls).forEach( fc => {
this.userForm.get(fc).reset(null, {onlySelf: true, emitEvent: false});
});