How can I display currency in Angular.js dynamically based on data per write?
I need to be able to dynamically show a currency with a value. For a fixed currency, I was able to:
<span id="currency-custom">{{amount | currency:'₹'}}</span>
But what if I wanted to change the currency based on what happened from the server? In my controller, I have:
$scope.longestRide = {
'fromAddress': 'xxx',
'toAddress': 'yyy',
'mycurrency': '₹',
'cost': '238',
'duration': '00:49:02'
}
But this doesn't work:
<span id="currency-custom">{{amount | currency:mycurrency}}</span>
How can I display currency based on javascript data structure?
+3
source to share