tried every syntax i can guess couldnt make it works !
<!--- THIS WORKS FINE --->
<ion-card *ngFor="#post of posts">
{{post|json}}
</ion-card>
<!--- BLANK PAGE --->
<ion-card *ngFor="#post of posts track by post.id">
{{post|json}}
</ion-card>
<!--- Exception : Cannot read property 'id' of undefined --->
<ion-card *ngFor="#post of posts;trackBy:post.id">
{{post|json}}
</ion-card>
<!--- Exception : Cannot read property 'undefined' of undefined --->
<ion-card *ngFor="#post of posts;trackBy:posts[index].id">
{{post|json}}
</ion-card>
<!--- Blank page no exception raised ! --->
<ion-card *ngFor="#post of posts;#index index;trackBy:posts[index].id">
{{post|json}}
</ion-card>
the only approach that worked for me was
Creating method in controller Class
identify(index,post:Post){ return post.id }
and
<ion-card *ngFor="#post of posts;trackBy:identify">
</ion-card>
is this is only way ? can i not just specify a property name inline for trackBy ?
*ngFor
thatNgFor
forwards tohttps://angular.io/docs/ts/latest/api/core/IterableDifferFactory-interface.html
github.com/angular/angular/blob/master/modules/angular2/src/… (don't know how that diffing is working exactly yet though) – Protracthttps://angular.io/docs/ts/latest/api/core/IterableDifferFactory-interface.html
not found. Any other link? – BoyntontrackBy
. – Boynton*ngFor
– Vampire