Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在组件中使用以下代码,尽管位置设置了正确的值,但没有呈现任何内容:
<div class="row" *ngFor="#dailyForecast of location.forecast.list"> <h4>{{dailyForecast.dt * 1000 }} </h4> </div>
我猜 Angular 2 无法处理,location.forecast.list尽管它是我的 TypeScript 组件类中的一个有效对象数组。
location.forecast.list
请提供更多代码。
你应该处理'location == null'和'dailyForecast == null'
试试那些代码:
<div class="row" *ngFor="#dailyForecast of location?.forecast?.list"> <h4>{{dailyForecast?.dt * 1000 }} </h4> </div>