i using currency filter inside custom filter in ui-grid format cell data. please find below code.
helperservices.filter('getquantformat', function($filter) { return function(val) { if (val == 0) return; else return ($filter('currency')(val, "", 2)); } }); here currency filter adds parenthesis negative values. want use currency filter without parenthesis negative values.
how remove parenthesis currency filter?
i suggest write customcurrency filter. takes care of negative values. below :
var app = angular.module('myapp'); app.filter('customcurrency', ["$filter", function ($filter) { return function(amount, currencysymbol){ var currency = $filter('currency'); if(amount < 0){ return currency(amount, currencysymbol).replace("(", "-").replace(")", ""); } return currency(amount, currencysymbol); }; }]); so whenever amount less zero, can replace parenthesis negative sign.
hope helps :)
Comments
Post a Comment