alcfeoh
alcfeoh

Reputation: 2247

Angular 2 beta: ngFor and expressions

I use the following code in a component and nothing renders though location is set with the right value:

<div class="row" *ngFor="#dailyForecast of location.forecast.list">
    <h4>{{dailyForecast.dt * 1000 }} </h4>
</div>

I guess Angular 2 cannot deal with location.forecast.list though it's a valid array of objects in my TypeScript component class.

Upvotes: 1

Views: 402

Answers (1)

Zilong Wang
Zilong Wang

Reputation: 584

Please provide more code.

You should to deal with 'location == null' and 'dailyForecast == null'

try those code:

<div class="row" *ngFor="#dailyForecast of location?.forecast?.list">
    <h4>{{dailyForecast?.dt * 1000 }} </h4>
</div>

Upvotes: 1

Related Questions