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

后端 未结 9 678
自闭症患者
自闭症患者 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:47

    Oliver Salzburg's write-up was fantastic. Upvoted.

    Tip for anyone who might have this error. Mine was simply caused by forgetting to pass in an array for a directive controller:

    BAD

    return {
        restrict: "E",
        scope: {                
        },
        controller: ExampleDirectiveController,
        templateUrl: "template/url/here.html"
    };
    

    GOOD

    return {
        restrict: "E",
        scope: {                
        },
        controller: ["$scope", ExampleDirectiveController],
        templateUrl: "template/url/here.html"
    };
    

提交回复
热议问题