我在显示页面中有一个名为 Ordered 的列,它将订单号打印为:
<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'
时添加相同的内容。
我是 Angular 新手,但我尝试将上述相同的订单与购买一起放置,但对我不起作用。
请注意,订单和购买都必须满足以下条件:
'ng-if' => 'clTxn.ordered'
请帮帮我。
最佳答案
<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>
关于javascript - 如何使用 Angular 编写嵌套条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33670560/