如果不检查{object.field}是否存在,则出错
<ul *ngIf="user.categories.length > 0" *ngFor="#category of user.categories">
<li>
{{category.name}}
</li>
</ul>Cannot read property 'name' of null
<ul *ngIf="user.categories.length > 0" *ngFor="#category of user.categories">
<li *ngIf="category">
{{category.name}}
</li>
</ul>
ABOUTYOU
holdtom
随时随地看视频慕课网APP