My 'top level' Angular file is thus: the module definition and two filters. I'm running angularJS with rails.
(function(){
var app = angular.module('appname', ['Orders', 'TimePicker']);
app.filter('money', function() {
return function(input) {
return input > 0 ? '£' + input : "FREE";
};
});
app.filter('nodecimal', function() {
return function(input) {
input = parseInt(input)
return input % 1 === 0 ? input.toFixed(0) : input.toFixed(2) ;
};
});
})();
It runs on development, but in production, I'm getting the following error: "Error: error:unpr Unknown Provider. Unknown provider: nodecimalFilterProvider <- nodecimalFilter".
From what I've read, this is because of minification.
I've attempted to follow the instructions on the page, for example, putting the functions of the filters in an inline dependence injection like so:
app.filter('nodecimal', [function() {
return function(input) {
input = parseInt(input)
return input % 1 === 0 ? input.toFixed(0) : input.toFixed(2) ;
};
}]);
But this didn't work. I've attempted to follow the instructions on the error page:
https://docs.angularjs.org/error/$injector/unpr?p0=nodecimalFilterProvider%20%3C-%20nodecimalFilter
and on this stack overflow question:
"Uncaught Error: [$injector:unpr]" with angular after deployment
I'm going to try the ngmin-rails gem, but I hate installing gems as they seem to cause as many problems as the fix.