0

How do you bind to the currency field in Angular2?

If I have a table of data:

Currency | Amount | Desired Result

USD | 12,000 | $12,000

EUR | 10,000 | €10,000

I know the standard formatting pipe: {{ item.Amount | currency:'EUR':true:'1.2-2'}}

But I can't seem to do this dynamically?

Chris A
  • 144
  • 2
  • 11
  • Can you expand on what you mean by `dynamically` in this scenario? – DeborahK Jul 18 '17 at 19:54
  • So I'm iterating through a table of data and want to display the correct currency symbol for each row – Chris A Jul 18 '17 at 19:58
  • 4
    Have you try this `{{ item.Amount | currency: item.Currency :true:'1.2-2'}}` – William Han Jul 18 '17 at 20:07
  • I just tried the above from William and it works great! – DeborahK Jul 18 '17 at 20:14
  • @WilliamHan thats great thanks, I thought I tried that and it didn't work but it turns out I have a temperamental side issue when sometimes saved changes don't appear in the browser! Nice and simple. Can I mark comments as answers? – Chris A Jul 18 '17 at 20:24

0 Answers0