Angular *ngIf variable with async pipe multiple conditions

后端 未结 4 2110
粉色の甜心
粉色の甜心 2021-02-12 05:46

There\'s quite good doc of using *ngIf in Angular: https://angular.io/api/common/NgIf But, is that possible to have *ngIf async variable and multiple checks on that? Something l

4条回答
  •  星月不相逢
    2021-02-12 06:33

    Simply do it like this

    ...

    For "more complex" scenario do the following

    ...

    Edit: Previous wouldn't work since you cannot use *ngFor and *ngIf without using ng-template. You would do it like that for instance

    
      
    {{ user | json }}

    Here is a stackblitz.

提交回复
热议问题