Angular “Unknown Provider” error after minification with Grunt Build in Yeoman app

后端 未结 1 998
陌清茗
陌清茗 2020-12-09 02:02

I\'m having problems with grunt build on a Yeoman generated Angular app, using Coffee and Slim, with all libraries up-to-date. (The app was just generated a few

相关标签:
1条回答
  • 2020-12-09 02:38

    It sounds like the common issue of Angular's reliance on the name of arguments for dependency injection. Make sure when you pass dependencies that you include the dependency names as strings so that Angular will know what to inject after minification (since string values won't be changed in the minification process).

    myApp.controller('myCtrl', ['$scope', '$http', function($scope, $http) {
    
    }])
    

    From Angular docs: A Note on minification

    0 讨论(0)
提交回复
热议问题