1

I am having a column named Ordered in a show page which prints Order number as :

<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>

It is working fine with order, now I need to add the same when relTransaction.txnType == 'Purchase'. I am new to angular but I tried to put the same above Order with Purchase but didn't worked for me.

Note both Order and Purchase must be under this condition:

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

Please help me out.

5
  • Can you post the entire template code? Where did you put those conditions? In the attribute of a tag in your template? I Don't understand Commented Nov 12, 2015 at 12:10
  • Actually Just I need to write an extra ng-if condition under {'ng-if' => 'clTxn.ordered'} for Purchase like 'ng-if' => "relTransaction.txnType == 'Order' as shown in question. Commented Nov 12, 2015 at 12:14
  • Oh I see now, is it a HTML preprocessor? Please write HTML instead for people that can't read it Commented Nov 12, 2015 at 12:15
  • 1
    edited to html from haml Commented Nov 12, 2015 at 12:23
  • can you show us a fiddle Commented Nov 12, 2015 at 12:27

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

3 Comments

or ng-if="('Purchase' == relTransaction.txnType) || ('Order' == relTransaction.txnType)"
Actually we have to show "PO#" if 'ng-if' => "relTransaction.txnType == 'Purchase' and "Ord#" if 'ng-if' => "relTransaction.txnType == 'Order'
Then there are 2 different blocks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.