👍:0
You can do this, however you’d have to tack your bit of code that does the formatting to some global object (which IMO is not very maintainable). This is how you do it
myApp.controller('myCtrlr', ['$filter', '$scope', function ($filter, $scope) {
Chart.currencify = function(value) {
return $filter('currency')(value);
}
...
...
var myChart = new Chart(ctx).Line(data, {
scaleLabel: "<%=Chart.currencify(value)%>",
});
}]);
You could tack the currencify function to any global object (I’ve added it to the Chart js global object). All you have to make sure is that currencify
is defined before you initialize the chart (so you could also do it in myApp.run
).
Fiddle – http://jsfiddle.net/fntcdtve/