Failure error: load times for modules: authInterceptorService in requireJS and angularJS

I have a problem with my requirements. It displays an errorUncaught Error: Load timeout for modules: authInterceptorService

Here is my code .. are there any problems with it?

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']
});

      

I added the app and services in paths

because it was not recognized and I don't know why ...

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);
});

      

Please tell me where I am wrong. I'm new in requirejs and this is the first time I've used it. The sample I have is functional. it actually only contains a controller.

http://bl.ocks.org/marcoslin/df4b741e92b2829eeae8 here is the sample I got.

Thank you very much

+3


source to share





All Articles