将工厂注入控制器在 angular 1.6 中不起作用

Injecting factory to controller doesn't work in angular 1.6

我要为这个疯狂。

我有 3 个文件: app.js, app.services.provider.js, admin.js

在app.js中我定义了我的模块:

(function() {

    angular.module('myApp', ['ngRoute']).config(function ($routeProvider) {
         $routeProvider 
        .when("/admin", {
            templateUrl : "Admin.htm",
            controller: "AdminController"
        }).otherwise( {redirectTo: '/'} ) ;
    })

})();

现在在app.services.provider.js我定义了一个工厂:

(function() {

 angular.module("myApp").factory('appServicesProvider',function($scope, $http ) {
      function someFunction(){

      }

      return{someFunction:someFunction}

    });

})();

在 admin.js 我有我的控制器:

(function() {

angular.module("myApp")
.controller("AdminController",function($scope, $http, appServicesProvider) {

});

})();

现在我相信我在 index.html:

中以正确的顺序包含了 JS
<script src="js/app.js"></script>
<script src="js/app.services.provider.js"></script>
<script src="js/admin.js"></script>

然而,当我尝试 运行 代码时,我得到了异常:

angular.min.js:122 Error: [$injector:unpr] http://errors.angularjs.org/1.6.1/$injector/unpr?p0=<ng-view class="ng-scope">copeProvider%20%3C-%20%24scope%20%3C-%20appServicesProvide

而且我似乎无法理解什么时候出错

我尝试了几种方法:

它仍然显示该死的错误。

有人知道哪里出了问题吗?

感谢您的帮助, 埃里克

错误是因为您试图将 $scope 注入您的服务。没有 $scope 服务。