I've looked at three different ways to minify AngularJS scripts. However, none of them explains how I'm supposed to take into account custom filters. I have my code formatted like this:
app.controller("App", ["$scope","$timeout", function($scope, $timeout){...}]);
Along with some additional code like this:
app.filter('unsafe', function($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
});
When I minify all of the above, the filter isn't recognized anymore. How do I go about prepping my code for minification?
app.filter('unsafe', ['$sce', function($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
}]);
When minified that $sce is transformed in a variable called a so that it takes less space possible but angular doesn't recognize it anymore so you need to declare that that first parameter is still $sce but with another variable name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With