I'd like to listen to valuechanges of my form, but not for the entire form but only for the formcontrol that was changed.
If for example my form looks like this.
this.form = this._fb.group({
firstName: [''],
lastName: [''],
... // other stuff.
});
If I then subscribe to valuechanges
this.form.valueChanges.subscribe((e) => {
console.log(e);
});
Then filling in a firstname in the form would result in a printout of the entire form value object.
{firstName: 'input', lastName: '', ...}
But what I want to know is which form control (in this case the firstName
) was altered without subscribing to each individual form control. Such that my desired output is only
{firstName: 'input'}