javascript - how to set currency change(cents) into a superscript using AngularJS currency? -
i turn price tag format:
is possible in angularjs? decimals in superscript format. far i'm using filer {{ pricetag | currency}}
displays to:
if need build custom filter this, how go about? i'm not familiar angular filters, i'm still noob.
i found code, removes decimals. maybe if can modify , grab decimals in separate variable.
angular.module('your-module', []) .filter('mycurrency', [ '$filter', '$locale', function ($filter, $locale) { var currency = $filter('currency'), formats = $locale.number_formats; return function (amount, symbol) { var value = currency(amount, symbol); return value.replace( new regexp('\\' + formats.decimal_sep + '\\d{2}'), ''); } }]);
or regex set apart decimals , turn 2 scopes. scope.price = '24'
, scope.change = '92'
. again, how go splitting price tag w/ regex.
your appreciated.
Comments
Post a Comment