@kpesanka wrote:
Hi! I'm having an odd problem that only seemed to surface when I began using Ionic2 with Angular2 (as opposed to originally just using Angular2).
I have a Page that contains an ion-list, and I do an ngFor to loop through and create the ion-items. The relevant HTML:
<ion-list> <ion-item *ngFor="#unit of units"> {{unit.description}} </ion-item> </ion-list>
In my Page, the constructor sets its units property to be the units property of an injected service:
export class UnitsPage { units: Unit[] = []; constructor(unitService: UnitService) { this.units = unitService.units; }
The injected unitService takes a little while to get its units, so at the time the constructor fires, this.units is still an empty array. When it finally gets populated, the ion-list does not update. If I put the 'this.units' assignment inside a setTimeout, it works just fine. It's almost as if one-time binding is going on here.
Thoughts?
Posts: 1
Participants: 1