Javascript 在角度控制器中无法识别工厂

Javascript 在角度控制器中无法识别工厂,javascript,angularjs,angular-seed,Javascript,Angularjs,Angular Seed,我试图使用工厂将数据从一个控制器传递到另一个控制器,但由于某些原因,我的工厂在angular seed中无法被识别。这是我的app.js文件,我正在声明我的工厂 var myApp = angular.module('myApp', ['myApp.controllers','angularFileUpload', 'ngRoute']); // // myApp.config(['$routeProvider', function($routeProvider) { $routePro

我试图使用工厂将数据从一个控制器传递到另一个控制器,但由于某些原因,我的工厂在angular seed中无法被识别。这是我的app.js文件,我正在声明我的工厂

var myApp = angular.module('myApp', ['myApp.controllers','angularFileUpload', 'ngRoute']);
//
//
myApp.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/' ,{templateUrl:"/syncproto/partials/videoSlides.html"}, "sync").
        when('/scenarios', {templateUrl:"/syncproto/partials/scenarios.html"}, "scenariosCtrl").
        when('/scenarios/:id', {templateUrl:"/syncproto/partials/scenarios.html"}, "scenariosCtrl")
}]);

myApp.factory('Data', function() {
    var Data;
    return {
        getData: function () {
            return Data;
        },
        setData: function(value) {
            Data = value;
        }
    };
});
这是我使用工厂数据的控制器

.controller('scenariosCtrl', ['$scope', '$http', '$location', 'Data', function($scope, $http, Data) {
        $scope.scenarios = [];
        $scope.thumbnails = [];
        $scope.init = function(){
            console.log('init hit');
            $http({ method: 'GET', url: 'http://localhost:3000/scenarios' }).
                success(function (data, status, headers, config) {
                    angular.forEach(data, function(scenario) {
                        if (scenario.video.length != 0 && scenario.video[0].thumbnailLocation != undefined){
                        $scope.thumbnails.push(scenario.video[0].thumbnailLocation);
                        //console.log('thumbnail is' + scenario.video.thumbnailLocation);
                            $scope.scenarios.push(scenario);
                            console.log(scenario.video[0].thumbnailLocation);
                        }
                    });
                    //console.log($scope.scenarios);
                    console.log('success');
                }).
                error(function (data, status, headers, config) {
                    console.log('error');
                });
        console.log($scope.thumbnails);
        }

        $scope.showVideo = function(scenario){
            Data.setData(scenario);
            $location.path('/');

            //Data.setData($scope.scenarios[$scope.thumbnail.indexOf(thumbnail)]);
        }

    }])
问题是在调用
Data.setData(scenario)时,在
$scope.showVideo=function(scenario)
我得到错误
TypeError:Object#没有方法“setData”

.controller('scenariosCtrl', ['$scope', '$http', '$location', 'Data', function($scope, $http, Data)
您缺少$location服务的一个参数。应该是

.controller('scenariosCtrl', ['$scope', '$http', '$location', 'Data', function($scope, $http, $location, Data)