Tuesday, June 6, 2017

Can't bind to 'ngFor' since it isn't a known property of 'li'

The usage of *ngFor within the li or div element has changed .like an example given below states that #contact of contacts where #contact defines as local variable.

<li *ngFor="#contact of contacts"></li>

Instead of using #contact,kindly replace your code snippet with the following structure in order to declare local variables inside of structural directives.

<li *ngFor="let contact of contacts"

(click)="onSelect(contact)"

[class.clicked]="showDetail === true">

{{contact.firstName}} {{contact.lastName}}

</li>

Hope it will help you someDay.

Twitter @dotnetpiper

0 comments :

Post a Comment