简体   繁体   中英

Filter data using ng-repeat in angularjs

I have the data i want to get currency EUR value not USD how it is possible.

 [{"currency":"USD","amount":3260},
  {"currency":"EUR","amount":"320.00"}]

my code is

<div class="col-xs-6">
          <h5 ng-repeat="balance in balances">
            {{balance.amount | currencyFilter:balance.currency}} ({{balance.currency}})
          </h5>
</div>

If you want to display only data where currency not USD :

<div class="col-xs-6">
  <h5 ng-repeat="balance in balances | filter:{ currency : '!USD' } ">
    {{balance.amount}} ({{balance.currency}})
  </h5>
</div>

Try this -

<div class="col-xs-6">
    <h5 ng-repeat="balance in balances" ng-if="balance.currency !== 'USD'">
            {{balance.amount}} ({{balance.currency}})
    </h5>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM