Option to disable form control change event emit from user (HTML) actions #26292
Labels
area: forms
feature: insufficient votes
Label to add when the not a sufficient number of votes or comments from unique authors
feature: votes required
Feature request which is currently still in the voting phase
feature
Issue that requests a new feature
freq2: medium
Milestone
I'm submitting a...
Current behavior
When changing reactive form control value programmatically, we can disable emitting value change event by passing
{emitEvent: false}
as a secondsetValue()
argument.But when the form control is bound to HTML component in the template and user performs a change, there is no way I could found to prevent value change event from emitting.
Expected behavior
Allow enabling/disabling change event emitting as an option for form control. It should be possible when declaring form control (so probably in a AbstractControlOptions) and also as a AbstractControl method.
Form control with disabled event emitting should not emit change event after user changes in a view, and it's to discuss if it should by default also not emit events after programmatic changes by
setValue()
method.Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-gitter-jduydj
In a console you can see, that after choosing variant from the
select
change event is fired twice:updateValueAndValidity()
call.What is the motivation / use case for changing the behavior?
Only other option I can see to not fire that event is to not bind that control to template. But in this case we need to handle this control value separately, which also introduces redundant logic.
The text was updated successfully, but these errors were encountered: