Situation
I have a form with 8 fields, but I want to monitor changes in just three of them to apply the same function. I don't want to set up individual subscriptions for each field like this:
this.headerForm.get('start').valueChanges.subscribe(() => applyFunction());
this.headerForm.get('end').valueChanges.subscribe(() => applyFunction());
this.headerForm.get('middle').valueChanges.subscribe(() => applyFunction());
Instead, I'm trying this approach:
merge([
this.headerForm.get('start').valueChanges,
this.headerForm.get('end').valueChanges,
this.headerForm.get('middle').valueChanges
]).subscribe(value => console.log(value));
However, it's not functioning as expected. When I start the app, it displays an error message like the one in this screenshot, and doesn't show any changes in the console when I modify those fields: