angular 5 template forms detect change of form validity status

后端 未结 3 972
说谎
说谎 2020-12-13 14:11

are reactive forms the way to go in order to have a component that can listen for changes in the validity status of the form it contains and execute some compoment\'s method

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 14:53

    You can subscribe to the whole form changes and implement your logic there.

    @ViewChild('myForm') myForm;
    
    this.myForm.valueChanges.subscribe(data => console.log('Form changes', data));
    

提交回复
热议问题