“Unknown provider: aProvider <- a” How do I find the original provider?

后端 未结 9 654
自闭症患者
自闭症患者 2020-12-07 08:46

When I\'m loading the minified (through UglifyJS) version of my AngularJS application, I get the following error in the console:

Unknown provider: aProvider          


        
9条回答
  •  时光取名叫无心
    2020-12-07 09:28

    To minify angular all you need is to do is to change your declaration to the "array" declaration "mode" for example:

    From:

    var demoApp= angular.module('demoApp', []);
    demoApp.controller(function demoCtrl($scope) {
    } );
    

    To

    var demoApp= angular.module('demoApp', []);
    demoApp.controller(["$scope",function demoCtrl($scope) {
    }]);
    

    How to declare factory services?

    demoApp.factory('demoFactory', ['$q', '$http', function ($q, $http) {
        return {
              //some object
        };
    }]);
    

提交回复
热议问题