1

I want to show one more currencies in a page. For example

$100,000 And 100,000€

When I use $filter('currency')(100000, '€') it returns €100,000. But I want it as 100,000€ The problem is I cannot replace the symbol. Any idea ?

1 Answer 1

3

You can always create a custom filter.

app.filter('customCurrency',['$filter', function(filter) {
  var currencyFilter = filter('currency');
  return function(amount, currencySymbol) {
    var value = currencyFilter(amount).substring(1);
    var currency = "";
    switch(currencySymbol) {
      case '$':
        currency = currencySymbol + value;
        break;
      case '€':
        currency = value + currencySymbol;
        break;
    }
    return currency;
  }}])

Here is the working example: http://plnkr.co/edit/IIWG18?p=preview

Sign up to request clarification or add additional context in comments.

Comments

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.