Reputation: 2502
I am using angular 4 and i want check that is any value is changed by user or not? In my page there are more than 100 control(textbox ,dropdown and editable grid)
I need to check only if any value is changed or not.
Upvotes: 0
Views: 263
Reputation: 8065
You can subscribe to the formControl's valuesChanged property.
yourFormControl.valuesChanged.subscribe( value => {
console.log(value); //will output the new value from yourFormControl
});
Note that the form itself has this property.
this.yourForm = this.formBuilder.group( /* etc... */)
this.yourForm.valuesChanged.subscribe( form => {
console.log(form); //will output the new value from the entire form, every time one of its child is changed
});
Upvotes: 3