Finding the cause of “Unknown provider” errors

后端 未结 4 717
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 20:57

I\'m getting the following error:

Error: [$injector:unpr] Unknown provider: nProvider <- n

I know this is being caused by the minifi

4条回答
  •  再見小時候
    2021-01-30 21:50

    While there does not appear to be any great way to debug these DI issues if you have no idea where to look, I had a sense mine was in a less than obvious place ... and it was:

    App.Services = angular.module('spokenvote.services', ['ngResource', 'ngCookies'])
        .config(servicesConfig)
        .run(($rootScope, $location) -> $rootScope.location = $location)
    

    needed to be:

    App.Services = angular.module('spokenvote.services', ['ngResource', 'ngCookies'])
        .config(servicesConfig)
        .run(['$rootScope', '$location', ($rootScope, $location) -> $rootScope.location = $location])
    

提交回复
热议问题