Angular2 *ngIf check object array length in template

后端 未结 5 643
北恋
北恋 2020-12-12 23:43

Refered to https://angular.io/docs/ts/latest/guide/displaying-data.html and stack How to check empty object in angular 2 template using *ngIf still getting syntax error self

5条回答
  •  抹茶落季
    2020-12-12 23:47

    This checks first if teamMembers has a value and if teamMembers doesn't have a value, it doesn't try to access length of undefined because the first part of the condition already fails.

提交回复
热议问题