2017-04-11 66 views
-1

我有一個HTML,NG-如果有多個標籤開始工作,我想申請中的屬性角JS NG-如果conditons

<td class="text-right" ng-if-start="hascancelData" rowspan="2" ng-if-end> 
    <strong>{{cancelData.refundAmount | currency}}</strong> 
    </td> 

我要申請行跨度=「2」只有當hascancelData:真。我曾嘗試^^

+2

你不能做到這一點,你可以試試'行跨度=「{{hascancelData? 2:''}}「' – Satpal

+0

可能的重複[在Angular中有條件地應用屬性的最佳方式是什麼?](http://stackoverflow.com/questions/15696416/what-is-the-best-way-to -conditionally-apply-attributes-in-angular) – Icarus

+0

不,它不是重複ng-if開始使用多個標記,我想在屬性中應用 –

回答

0

試試這個:

<td class="text-right" ng-if="hascancelData" rowspan="{{hascancelData}}?'2':''"> 
    <strong>{{cancelData.refundAmount | currency}}</strong> 
    </td> 
1

你可以做這樣的事情:

<td class="text-right" ng-if-start="hascancelData" rowspan="{{hascancelData ? 2 : ''}}" ng-if-end>