未捕获的错误:模块的加载超时:requireJS和angularJS中的authInterceptorService

时间:2014-09-16 05:29:17

标签: angularjs requirejs

我现在有一个关于我的requirejs的问题..它显示错误Uncaught Error: Load timeout for modules: authInterceptorService

这是我的代码..它有什么问题吗?

main.js

require.config({
    baseUrl: "",
    paths: {
        'angular'                   : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/angular.min',
        'angular-route'             : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/angular-route.min',
        'angular-local-storage'     : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/angular-local-storage.min',
        'loading-bar'               : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/loading-bar.min',
        'ui-bootstrap-tpls-0.11.0'  : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/ui-bootstrap-tpls-0.11.0.min',
        'angular-idle'              : 'http://cdn.dbtc.sdb.ph/angularjs/1.2.24/angular-idle.min',
        'angularAMD'                : 'scripts/angularAMD.min',
        'app'                       : 'app/app',
        'authInterceptorService'    : 'app/Services/authInterceptorService', //services
        'authService'               : 'app/Services/authService' //services
    },

    shim: {
        'angularAMD'                : ['angular'],
        'angular-route'             : ['angular'],
        'angular-local-storage'     : ['angular'],
        'loading-bar'               : ['angular'],
        'ui-bootstrap-tpls-0.11.0'  : ['angular'],
        'angular-idle'              : ['angular'],
        'authInterceptorService'    : ['app'],
        'authService'               : ['app']
    },

    deps : ['app']
});

我在paths添加了我的应用和服务,因为它没有被识别,我也不知道为什么......

app.js

define(['angularAMD', 'angular-route', 'angular-local-storage', 'loading-bar', 'angular-idle', 'ui-bootstrap-tpls-0.11.0','authInterceptorService'], function (angularAMD) {

    //start of app

    var app = angular.module("Aptus", ['ngRoute', 'LocalStorageModule', 'angular-loading-bar', 'ngIdle', 'ui.bootstrap']);

    app.config(function ($routeProvider) {
        $routeProvider.when("/home", angularAMD.route({
            controller: "homeController",
            templateUrl: "templates/home.html",
            controllerUrl : "app/Controllers/HomeController"
        }));

        $routeProvider.when('/evaluations', angularAMD.route({
            controller: 'EvaluationController',
            templateUrl: 'Projects/Evaluation/templates/evaluation.html',
            controllerUrl: 'app/Controllers/EvaluationController'
        }));
        $routeProvider.when('/evaluate', angularAMD.route({
            controller: 'CriteriaController',
            templateUrl: 'Projects/Evaluation/templates/evaluate.html',
            controllerUrl: 'app/Controllers/CriteriaController'
        }));
        $routeProvider.when("/login", angularAMD.route({
            controller: "loginController",
            templateUrl: "login.html",
            controllerUrl: "app/Controllers/loginController"
        }));
        $routeProvider.when("/summary", angularAMD.route({
            controller: 'SummaryController',
            templateUrl: 'Projects/Evaluation/templates/classes.html',
            controllerUrl: 'app/Controllers/SummaryController'
        }));
        $routeProvider.when("/coursesummary", angularAMD.route({
            controller: 'CourseSummaryController',
            templateUrl: 'Projects/Evaluation/templates/coursesummary.html',
            controllerUrl: 'app/Controllers/SummaryController'
        }));
        $routeProvider.when("/studentclasses", angularAMD.route({
            controller: 'StudentClasses',
            templateUrl: 'Projects/Evaluation/templates/studentclasses.html',
            controllerUrl: 'app/Controllers/SummaryController'
        }));
        $routeProvider.when("/subject", angularAMD.route({
            controller: 'Subject',
            templateUrl: 'Projects/Evaluation/templates/subject.html',
            controllerUrl: 'app/Controllers/SummaryController'
        }));
        $routeProvider.when("/user", angularAMD.route({
            controller: 'UserController',
            templateUrl: 'Projects/Evaluation/templates/user.html',
            controllerUrl: 'app/Controllers/SetupController'
        }));
        $routeProvider.when("/role", angularAMD.route({
            controller: 'RoleController',
            templateUrl: 'Projects/Evaluation/templates/role.html',
            controllerUrl: 'app/Controllers/SetupController'
        }));
        $routeProvider.when("/report", angularAMD.route({
            controller: 'RoleController',
            templateUrl: 'Projects/Evaluation/templates/report.html',
            controllerUrl: 'app/Controllers/SetupController'
        }));

        $routeProvider.otherwise({ redirectTo: '/home' });
    });

    app.run(['authService', function (authService) {
        authService.fillAuthData();
    }]);

    app.config(function ($httpProvider) {
        $httpProvider.interceptors.push(['authInterceptorService']);
    });


    app.config(['$keepaliveProvider', '$idleProvider', function ($keepaliveProvider, $idleProvider) {
        $idleProvider.idleDuration(15 * 60);
        $idleProvider.warningDuration(10);
        $keepaliveProvider.interval(15 * 60);
    }]);

    app.run(['$idle', function ($idle) {
        $idle.watch();
    }]);

    app.run(function ($rootScope, localStorageService) {

        //localStorageService.get('currentModule') === 'undefined')
        if (typeof sessionStorage.getItem('currentModule') === 'undefined') {
            var data = {
                moduleName: 'Dashboard',
                moduleDescription: 'Home'
            };
            sessionStorage.setItem('currentModule', JSON.stringify(data));
            //localStorageService.set('currentModule', data);
        }

        $rootScope.currentModule = JSON.parse(sessionStorage.getItem('currentModule')); //localStorageService.get('currentModule');


    });


    app.directive('a', function () {
        return {
            restrict: 'E',
            link: function (scope, elem, attrs) {
                if (attrs.href === '' || attrs.href === '#') {
                    elem.on('click', function (e) {
                        e.preventDefault();
                    });
                }
            }
        };
    });

    //end of app

    return angularAMD.bootstrap(app);
});

请告诉我哪里错了..我在requirejs中是新手,这是我第一次使用它..我的样本是功能性的。实际上它只包含控制器..

http://bl.ocks.org/marcoslin/df4b741e92b2829eeae8这是我得到的样本..

非常感谢

0 个答案:

没有答案