Template Reference Variable in AngularJS

Viewed 88

I created a form in angular 13 and include a input filed like in below.

<form>
     <input type="text" name="name" [(ngModel)]="_name" #_name="ngModel" required>
</form>

then it gives a error like this,

Cannot assign value "$event" to template variable "_name". Template variables strong text are read-only.

however I change the template reference variable #_name to #name error is gone. can anyone helop me to find the reason for that?

0 Answers
Related