Angularjs 在 Controller 中添加为依赖项时工厂未加载

Angularjs Factory not loading when added as dependency in Controller

我是 Angularjs 的新手,这是我第一次尝试用它构建应用程序。我在 index.html 文件中加载了以下文件。

<!--Angularjs-->
<script src="assets/js/vendor/angular.min.js" type="text/javascript"></script>
<script src="assets/js/vendor/angular-route.min.js" type="text/javascript"></script>

<!--SleekDocketAppJS-->
<script src="app/app.module.js" type="text/javascript"></script>
<script src="app/app.route.js" type="text/javascript"></script>

<!--Controllers-->
<script src="app/components/dashboard/controller/dashboardController.js" type="text/javascript"></script>
<script src="app/components/product/controller/productController.js" type="text/javascript"></script>

他是我的 app.module.js 文件,我想在这里添加一个工厂名称 AuthFactory

'use strick';

var docket = angular.module("docket",['ngRoute']);

//Factory
docket.factory('AuthFactory',function(){

    console.log('auth factory');
    var authdata = {};
    authdata.name = "user 1";
    return (authdata);
});

//Running
docket.run(function(){
    console.log("runing...");
});

这是我的 app.route.js 文件,我在其中根据路由调用我的控制器。

'use strict';

var docket = angular.module('docket');

docket.config(['$routeProvider',function($routeProvider){
    $routeProvider
    .when("/",
    {
            controller:"DashboardController",
            templateUrl: "app/components/dashboard/view/dashboard.html"
        })
        .when("/product",{
            controller:"productController",
            templateUrl: "app/components/product/view/product.html"
        })
        .otherwise({
            redirectTo:'/'
        });
}]);

我的简单dashboardController.js看起来像这样

var app = angular.module('docket');

    app.controller('DashboardController',['$scope, AuthFactory', function($scope, AuthFactory){

        console.log('dash controller');
        //console.log(AuthFactory);
    }]);

但是当我尝试 运行 使用加载服务 DashboardController 的应用程序时,我得到了他的错误。但是,如果我从控制器依赖项中删除该服务,则不会出现错误。

这里是 $scope

后面的拼写错误“'”
app.controller('DashboardController',['$scope, AuthFactory', function($scope, AuthFactory)

改为

app.controller('DashboardController',['$scope', 'AuthFactory', function($scope, AuthFactory)