Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use `registerOnChange` or `valueChanges` on a form control

It seems that I can listen to changes on the control using registerOnChange or valueChanges method. I'm confused as to when to use what. valueChanges returns observable, so it makes sense to work with it as it provides many handy methods. When to use registerOnChange then?

like image 837
Max Koretskyi Avatar asked Feb 13 '17 06:02

Max Koretskyi


1 Answers

registerOnChange is mostly for internal use (AFAIR used by CONTROL_VALUE_ACCESSOR and only allows a single subscriber) - therefore definitely use valueChanges instead.

like image 81
Günter Zöchbauer Avatar answered Oct 24 '22 03:10

Günter Zöchbauer