Search code examples
angularjsangular-filters

Write custom currency filter that will do converting based on locale in Angularjs


I have some value that represent price. I want when i change locale in my navbar to convert that price. So i was wondering is it possible to do that with custom filter?


Solution

  • It's possible, yes. But instead of converting the price to an other currency on the frontend, you should get the price information from the backend in the currency you're requesting it, since it's a data and you shouldn't mess around with it on the frontend, especially because it's money.