How can i use *ngIf condition in below code?

时间:2017-12-18 06:13:26

标签: ionic-framework

Here I want to check the condition but I am not able to check.

 <text-avatar id="av" item-start [text]="item.BN" [color]="item.color">                      

     <ion-icon id="check" name="checkmark-circle" float-start></ion-icon>                      

 </text-avatar>

1 个答案:

答案 0 :(得分:0)

就这么简单,someBoolean可以是通过组件类

检索的任何布尔值

<强> home.tst

. . .

class Home {
   var someBoolean: boolean = false;
   var myArray: any[];

   constructor() {
      // compare values with array here or in any other method
      if (true) {
         someBoolean = true;
      }
   }
}

<强> home.html的

<text-avatar id="av" item-start [text]="item.BN" [color]="item.color" *ngIf="someBoolean">                      

     <ion-icon id="check" name="checkmark-circle" float-start></ion-icon>                      

 </text-avatar>