AngularJS throws Unknown provider: $scopeProvider <- $scope error when I try to use modules

后端 未结 1 1680
傲寒
傲寒 2020-12-10 02:48

I have just started with AngularJS The following code gives an error in the console.

Unknown provider: $scopeProvider <- $scope <- newActiveOrdersModel . I hav

相关标签:
1条回答
  • 2020-12-10 03:01

    This just a guess but I don't know why you have $scope listed as a dependency of your service. I think something like this

     app.service('newActiveOrdersModel', ['$rootScope',
        function($rootScope){..}]
    

    will solve the error. Also I wouldn't include $rootScope unless you absolutely need it. It's generally considered bad practice in Angular to store stuff in the $rootScope.

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