Minimizing AngularJS script that includes a custom filter

I looked at three different ways to minimize AngularJS scripts. However, none of them explain how I should account for custom filters. I have code formatted as follows:

app.controller("App", ["$scope","$timeout", function($scope, $timeout){...}]);

Along with additional code like this:

app.filter('unsafe', function($sce) {
    return function(val) {
        return $sce.trustAsHtml(val);
    };
});

When I reduce all of the above, the filter is no longer recognized. How do I go to my code for clarification?

+4
source share
1 answer

app.filter('unsafe', ['$sce', function($sce) {
    return function(val) {
        return $sce.trustAsHtml(val);
    };
}]);
Run codeHide result

minified, $sce a, , angular , , $sce,

+7

Source: https://habr.com/ru/post/1623549/


All Articles