小编Tan*_*til的帖子

如何在离子html模板中编写条件语句

我正在将我的应用程序从jquery移植到离子框架.在jquery中,我正在编写javascript代码来手动连接html标签.从jquery代码中粘贴相同的一部分

  for ( count = start - 1; count < end ; count ++ )
            {
                if (tranList[count].tranType == "R" )
                    tranType = "Redeem" ;
                else 
                    tranType = "Earn";

                text += "<tr> <td>"+ tranType +  "</td>" ;
Run Code Online (Sandbox Code Playgroud)

在Ionic中,我试图使用离子列表编写相同的代码.下面是我的html模板

 <ion-list>
    <ion-item *ngFor="let tran of transactions">
     <p> {{tran.pointsEarned}} </p> 
    </ion-item>
  </ion-list>
Run Code Online (Sandbox Code Playgroud)

在PointsEarned旁边,我需要打印点数被兑换或获得类似于jquery代码.我如何实现这一目标?

typescript ionic-framework ionic2 ionic3 angular

7
推荐指数
3
解决办法
3万
查看次数

标签 统计

angular ×1

ionic-framework ×1

ionic2 ×1

ionic3 ×1

typescript ×1