Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Language Service Pipe causes identifier not defined error

Am I doing something wrong? Here is a simple for loop

*ngFor="let group of (groups | slice: 0:5)"
[id]="group.GroupNum"

When I do it this way i get Identifier 'GroupNum' is not defined. 'T' does not contain such a member

If I remove the pipe then the error goes away. I believe the error is just with the Angular Language Service (VS Code) as the code still works as I would expect and the Angular CLI does not give me any errors.

If someone could point me in the right direction I would appreciate it.

P.S. The interface for groups is defined and if I change it to any it still gives me the error.

like image 784
JeffBeltran Avatar asked Nov 06 '22 14:11

JeffBeltran


2 Answers

*ngFor="let group of $any(groups | slice:0:5)"

$any will remove the error of "Object is unknow"

like image 90
Anand mishra Avatar answered Nov 15 '22 05:11

Anand mishra


Removing the whitespace in the argument should work.

*ngFor="let group of (groups | slice:0:5)"

like image 45
Abu Taha Avatar answered Nov 15 '22 07:11

Abu Taha