Unresolved variable or type x in angular template name attribute
If I have many inputs in with a name attribute in some angular templates. For example (using primeng components):
<input id="newRecipientFamilyName" name="newRecipientFamilyName" class="w-100" type="text" pInputText
[(ngModel)]="newRecipient.familyName">
The IDE gives a warning: Unresolved variable or type newRecipientFamilyName
I get the same warning with a much simpler example:
<input #thing name="thing" type="text" />
This does not occur for other elements:
<p-radioButton name="anotherThing" ></p-radioButton>
Curiously, if I try to run the suggested "Create Variable thing", I get:
<input name="private thing;
thing" type="text" />
which is clearly not a solution.
Also, if I create a reference variable of the same name:
<input #thing name="thing" type="text" />
Then that actually works, but I really don't want to add a bunch of reference variables just to get rid of a mistaken warning.
I have recently upgraded to IntelliJ to 2021.3.2 (Ultimate Edition). Build #IU-213.6777.52, built on January 27, 2022. I did an Invalidate Caches, but I still get the same result.
Any suggestions?
Thanks!
请先登录再写评论。
can't reproduce with similar code
Can you repeat the issue in a new Angular CLI project?
I'm running up against a deadline, and will have to get back to you.