patchValue with { emitEvent: false } triggers valueChanges on Angular 4 formgroup patchValue with { emitEvent: false } triggers valueChanges on Angular 4 formgroup angular angular

patchValue with { emitEvent: false } triggers valueChanges on Angular 4 formgroup


Try adding onlySelf: true along with the emitEvent: false in this way:

this.ticketForm.patchValue(ticket, {emitEvent: false, onlySelf: true});


Can't comment because of rep, so I will post it as an answer to @Craig Wayne.

emitEvent:false works only if you are listening to value changes on the form control with:

this.form.valueChanges.controlName.subscribe(val => doSomething(val));

if you are binding to model changes on the element event is emitted regardless:

<input (ngModelChange)="doSomething($event)"/>


While working with Angular 9.1.13 I had been facing the same problem.Tried to use the FormControl.setValue, and FormGroup.patchValue APIs, using also the suggested params {emitEvent: false, onlySelf: true} in all possible combinations.The valueChanges observable is was still being triggered.

The only thing that worked for me eventually was :

myForm.disable();myForm.patchValue({myControl: ''}, {onlySelf: true, emitEvent: false});myForm.enable();