Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property binding ngForIn not used by any directive on an embedded template - Ionic 2

Tags:

angular

ionic2

Trying to run a *ngFor within the html like this. But, this error shows up.

Property binding ngForIn not used by any directive on an embedded template

This is the html code:

<ion-card *ngFor="#media in medias">

I've had this happen in my previous project as well, still figuring it out. Any clues?

Still new to Ionic2 & Angular2.

like image 333
Nick Kenens Avatar asked Jan 17 '16 22:01

Nick Kenens


1 Answers

Your are mistaken with angular1 syntaxes:

Instead of *ngFor="#media in medias",

you have to write *ngFor="#media of medias"

UPDATE - as of beta.17, use the let syntax instead of #. This updates to the following:

<div *ngFor="let media of medias">

https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html

like image 56
Raphael Avatar answered Nov 01 '22 15:11

Raphael