I’m trying to detect changes in my template-driven form but It throws an error because of NgModel is not using the standalone property.
when adding it neglects the value changes
this.ngForm.form.valueChanges.subscribe((x) => {
debugger
if (
x.selectedProject &&
x.selectedProject !== this.wizardService.selectedProject
) {
debugger;
console.log(true);
}
})
```
it is not going throw the function above but when removing the standalone flag it works but I get the Ngmodel form error
2
Answers
Try this one:
In a template drive form you need give "name" to your input, e.g.
Has no related with
[ngModelOptions]={standalone:true}
(see that it’s between[
]
. This attribute is used when you have inside a formGroup.BTW,we can control when change in several ways
Split ngModel
Getting with a ViewChild and subscribe to control.valueChanges
using the event input