在angular2中的空数组中模板化/呈现属性?

在angular2中的空数组中模板化/呈现属性?,angular,angular2-template,Angular,Angular2 Template,在angular 1中,您可以引用深度属性,并且(在大多数情况下)它将继续摇摆: <div ng-repeat='thing in ctrl.list'> {{thing.property[0].anotherProp}} </div> {{thing.property[0]。其他属性} 我确信我可以*ngIf父属性以确保它存在,或者展平原始POJO。只是想知道我是否错过了什么?是的,你错过了: {{thing.property[0]?.anotherPro

在angular 1中,您可以引用深度属性,并且(在大多数情况下)它将继续摇摆:

<div ng-repeat='thing in ctrl.list'>
   {{thing.property[0].anotherProp}}
</div>

{{thing.property[0]。其他属性}
我确信我可以*ngIf父属性以确保它存在,或者展平原始POJO。只是想知道我是否错过了什么?

是的,你错过了:


{{thing.property[0]?.anotherProp}

<div ng-repeat='thing in ctrl.list'>
   {{thing.property[0].anotherProp}}
</div>
<div *ngFor='#thing of list'>
   {{thing.property[0]?.anotherProp}}
</div>