AngularJS Error: $injector:unpr Unknown Provider

后端 未结 13 937
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 08:10

I\'m trying to build my own service by following the example in the documentation for the factory methodology. I think I\'ve done something wrong however because I continue

13条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 09:11

    This error is also appears when one accidntally injects $scope into theirs factory:

    angular.module('m', [])
        .factory('util', function ($scope) { // <-- this '$scope' gives 'Unknown provider' when one attempts to inject 'util'
           // ...
        });
    

提交回复
热议问题