angular.js - wrapping the currency symbol and decimal numbers in spans

后端 未结 3 2162
遥遥无期
遥遥无期 2021-02-13 21:35

Can you possibly do something like this in angular?

\"enter

It\'s not quite possib

3条回答
  •  走了就别回头了
    2021-02-13 22:18

    It's actually possible to do this

    or wrap it around the native currency filter like this

    app.filter('currencys', ['$filter', '$locale', 
        function($filter, $locale) {
            return function (num) {
                var sym = $locale.NUMBER_FORMATS.CURRENCY_SYM;
                return $filter('currency')(num, ''+ sym +'');
            };
        }
    ]);
    

    and then use it like this

提交回复
热议问题