Tagged: errors in html
- This topic has 5 replies, 3 voices, and was last updated 5 years, 7 months ago by
support-swapna.
-
AuthorPosts
-
MuhammedShakirParticipantin my component html file, I get errors for registrationForm.controls.username where in registrationForm is the FormGroup object. It says “identifier username is not defined. __type does not contain such a member”. Please help
November 13, 2019 at 12:00 am #631425
support-swapnaModeratorMuhammed,
This looks like a code related issue.
Can you please check these threads discussing similar issue and see if any of the suggestions help?
https://github.com/angular/vscode-ng-language-service/issues/152
https://stackoverflow.com/questions/47466324/identifier-required-is-not-defined-type-does-not-contain-such-a-memberIf you are still seeing problems, please share with us the sample project (zipped project) exhibiting the error to help us replicate the problem at our end.
Hope this helps.
–Swapna
Genuitec SupportNovember 13, 2019 at 6:01 pm #631506
MuhammedShakirParticipantHi Swapna,
Note that the code works like a charm without any errors. It is just that the IDE shows the error. Upon execution it executes as expected. However, when prepended with !! the error goes off
November 14, 2019 at 5:51 am #631555
support-swapnaModeratorMuhammed,
Glad that the workaround helps. We will look into it.
Please let us know if you see any other issues.–Swapna
Genuitec SupportNovember 22, 2019 at 9:20 pm #632372
JohnParticipantIn some case the error will go off. For example:
Component:
class NotificationBase { version: number = 0; timeCreated = Date.now(); priority: NotePriority = NotePriority.NORMAL; body?: any; } public notifications: NotificationBase[] = [];
HTML
<li *ngFor="let alert of notifications | slice:(page-1)*limit:page*limit; let i = index"> <a href="javascript:;" class="dropdown-item mg-dropdown-item" (mouseover)="toggleShowX(true, i)" (mouseleave)="toggleShowX(false, i)" (click)="openAlert(alert, i)"> <span class="mg-nf-alert"> <span class="mg-nf-alert-head" [class.mg-nf-low]="alert.priority === 1" [class.mg-nf-normal]="alert.priority === 2" [class.mg-nf-high]="alert.priority === 3" [class.mg-nf-critical]="alert.priority === 4"> {{!!alert.body.header}} </span> <span *ngIf="!!alert.body.badge" class="mg-nf-label"> {{!!alert.body.badge}} </span> <span (click)="dismiss(alert, i)" class="mg-nf-close" [class.mg-nf-close-show]="showClose[i] && alert.body.dismiss"> <i class="fa fa-times-circle"></i> </span> </span> <span class="mg-nf-time"> {{timePassed(!!alert.timeCreated)}} </span> </a> </li>
In the above code i see the following errors which do not go away with !! when the line is
- [class.mg-nf-normal]=”alert.priority === 2″
However, I can make the error go away on *ngIf and embedded {{variable}}.
Definitely a problem.
November 26, 2019 at 1:22 pm #632898
JohnParticipantAn update here. The !! before your variable does not provide even a partial fix. It seems that most objects with properties show as errors when referenced from html. They do work correctly.
November 27, 2019 at 6:29 am #633004
support-swapnaModeratorJohn,
Apologies for the delayed response. We are looking into the reported issues.
We will keep you posted about our findings soon.Sorry for inconvenience caused.
–Swapna
Genuitec Support -
AuthorPosts