How to check empty object in angular 2 template using *ngIf

前端 未结 7 1236
逝去的感伤
逝去的感伤 2020-12-04 16:26

I want to check if my object is empty dont render my element, and this is my code:


      
7条回答
  •  广开言路
    2020-12-04 17:10

    Above answers are okay. But I have found a really nice option to use following in the view:

    {{previous_info?.title}}

    probably duplicated question Angular2 - error if don't check if {{object.field}} exists

提交回复
热议问题