To convert currency from US to UK in AngularJS

后端 未结 2 725
予麋鹿
予麋鹿 2021-01-20 07:15

I tried this code to display but I need AngularJS to automatically convert currency:

 
default currency symbol ($): {{0.
2条回答
  •  粉色の甜心
    2021-01-20 07:48

    AngularJs currencyFilter just formats output. If you want actually convert currency, you need to make custom filter, for example.

    Here is possible example:

    angular.module('myFilter', []).filter('currencyConverter', [function() {
       function convert(inputValue, currecyId) {
           // Your conversion code goes here
       }
    
       return function(inputValue, currencyId) {
          return convert(inputValue, currencyId);
       }
    });
    

提交回复
热议问题