How to watch all FormControls ValueChanges except specific control?

后端 未结 4 1860
名媛妹妹
名媛妹妹 2021-01-12 10:33

I have a form that do a computation whenever a control input value changes.

Here is my form_group looks like:

form_group = this.fb.group         


        
4条回答
  •  花落未央
    2021-01-12 11:11

    You can merge individual valueChanges Observables into one like so :

    Observable.merge(
        [ control1.valueChanges,
          control2.valueChanges ]
      ).subscribe(() => {
        // do your computation
      });
    

提交回复
热议问题