2015-11-12 53 views
1

我有一個名爲的節目頁面有序列其打印訂單號爲:如何使用Angular編寫嵌套條件?

<div class="col-sm-2 detail" ng-if="clTxn.ordered"> 
    <a ng-if="relTransaction.txnType == 'Order'" ng-repeat="relTransaction in clTxn.relTransactions" ui-sref="order({id: relTransaction.txnId })">{{'Ord#'}}</a> 
    <div class="title">Ordered</div> 
</div> 

這是工作的罰款與秩序,現在我需要添加相同relTransaction.txnType == 'Purchase'時。 我是新角度,但我試圖把上面的訂單與購買訂單,但沒有爲我工作。

注意兩個訂單和採購必須在此條件下:

'ng-if' => 'clTxn.ordered'

請幫助我。

+0

你可以發佈整個模板代碼嗎? 你把這些條件放在哪裏?在模板中的標籤的屬性? 我不明白 – Zorgatone

+0

其實我只是需要在** {'ng-if'=>'clTxn.ordered'} **下寫一個額外的ng-if條件,就像'ng-if'=> 「relTransaction.txnType =='Order'' as shown shown in question。 – venkat

+0

哦,我現在看到了,它是一個HTML預處理器嗎? 請爲無法讀取它的人編寫HTML代碼 – Zorgatone

回答

1
<div class="col-sm-2 detail" ng-if="clTxn.ordered"> 
    <a ng-if="['Order', 'Purchase'].indexOf(relTransaction.txnType) != -1" ng-repeat="relTransaction in clTxn.relTransactions" ui-sref="order({id: relTransaction.txnId })">{{'Ord#'}}</a> 
    <div class="title">Ordered</div> 
</div> 
+2

或'ng-if =「('購買'== relTransaction.txnType)|| ('Order'== relTransaction.txnType)「' –

+0

其實我們必須顯示**」PO#「**如果''ng-if'=>」relTransaction.txnType =='Purchase'' and **「Ord #「** if if''ng-if'=>」relTransaction.txnType =='Order'' – venkat

+0

然後有兩個不同的塊 –