i've created filter cell data of ui-grid. want apply custom filter built-in currency filter of angular. please find below code:
var helperservices = angular.module("helperservices",['constants']); helperservices.filter('getpriceformat',function(){ return function(val, $filter){ if(val == 0) return; else return ($filter('currency')(val, "", 7)); } }); i getting error typeerror: undefined not function on return statement of else part.
how make built-in filter working inside custom filter ???
you're injecting $filter incorrectly, should be
helperservices.filter('getpriceformat',function($filter){ return function(val){ if(val == 0) return; else return ($filter('currency')(val, "", 7)); } });
Comments
Post a Comment