I have a form with some <input type="text">
widgets and I have noticed that ControlGroup.valueChanges
is being called upon initial databind when using [ngFormModel]
and ngControl
.
This means that the user thinks that the form has been changed upon initial load.
Is this normal or should I be using a different observable to track changes made the by the user?
I am using Angular2 RC3 and the following version import for forms:
import {ControlGroup, Validators, FormBuilder} from '@angular/common';
I think that's just how it works, however if you just want to track if changes are made by user, you should employ ControlGroup.dirty
or formControl.dirty
with the changes
Observable.
ControlGroup.valueChanges.subscribe(() => {
if(ControlGroup.dirty){
console.log('This change is made by User.');
}
else {
console.log('This change is Automated. before any User interaction.');
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With