0

I have read just about all the related responses to this question including this Why is my AngularJS module never loaded? and a few others and some how I am just not getting it right

this is what my app.js looks like

'use strict';
var appAcademia = angular.module("appAcademia",  ['seblucas.slPageSizeChanger', 'LocalStorageModule', 'ngRoute', 'ngAnimate',     'ui.bootstrap', 'ui.router', 'ngResource']).config(function ($routeProvider, $stateProvider, $urlRouterProvider,   $httpProvider, $resourceProvider) {
$httpProvider.interceptors.push('authInterceptorService');
$resourceProvider.defaults.stripTrailingSlashes = false;
$routeProvider.when('/home',
    {
        templateUrl: '/Home/Home',
        controller: 'HomeController'
    });

$routeProvider.when('/management',
        {
            templateUrl: '/management',
            controller: 'ManagementController',
            controllerAs: 'vm',
            secure: true
        });
$routeProvider.when('/createschoolmanagement',
        {
            templateUrl: '/management/createSchoolManagement',
            controller: 'ManagementController',
            controllerAs: 'vm',
            secure: true
        });
$routeProvider.when('/getschoolmanagement',
        {
            templateUrl: '/management/GetSchoolManagement',
            controller: 'ManagementController',
            controllerAs: 'vm',
            secure: true
        });
$routeProvider.when('/login',
        {
            templateUrl: '/home/login',
            controller: 'LoginController'
        });
$routeProvider.when('/signup',
        {
            templateUrl: '/home/signup',
            controller: 'SignupController'
        });
$routeProvider.when('/welcome',
        {
            templateUrl: '/home/welcome',
            controller: 'WelcomeController'
        });
$routeProvider.when('/users',
         {
             templateUrl: '/home/users',
             controller: 'UsersController',
             controllerAs: 'vm',
             secure: true
         });
//$routeProvider.when('/roles/:userId',
//         {
//             templateUrl: '/home/roles',
//             controller: 'UserEditController',
//             controllerAs: 'vm',
//             secure: true
//         });
$routeProvider.when('/createuser/:userId', {
    controller: 'UserEditController',
    templateUrl: '/home/EditUser',
    controllerAs: 'vm',
    secure: true //This route requires an authenticated user
});

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


var authServiceBase = 'http://localhost:26264/';
var resourceServiceBase = 'http://localhost:47039/';
appAcademia.constant('ngAuthSettings', {
apiAuthServiceBaseUri: authServiceBase,
apiResourceServiceBaseUri: resourceServiceBase,
clientId: '414e1927a3884f68abc79f7283837fd1'
});

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

All the modules below are created but never loaded Then I get the following error message in the console

"Uncaught Error: [$injector:nomod] Module 'appAcademia' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.3.0-build.3042+sha.76e57a7/$injector/nomod?p0=appAcademia"

when I run CCleaner and run the application again I get this error below Uncaught Error: [$injector:nomod] Module 'appAcademia' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.4.8/$injector/nomod?p0=appAcademia

Now watch the Url in both cases. The first one refers to angular 1.3.0 and the second one refers the version 1.4.8 which is the one i actually installed

i have tried out the best practices all to no avail. I have been at this for weeks.

Modules (63)
The best practice for module names is to use dot.case or lowerCamelCase.      Check the name of "LocalStorageModule".
Module "ngRoute" was created but never loaded.
Module "ngAnimate" was created but never loaded.
Module "ngResource" was created but never loaded.
Module "LocalStorageModule" was created but never loaded.
Module "ui.router.util" was created but never loaded.
 Module "ui.router.router" was created but never loaded.
Module "ui.router.state" was created but never loaded.
Module "ui.router" was created but never loaded.
Module "ui.router.compat" was created but never loaded.

 Module "appAcademia" was created but never loaded.

1 Answer 1

2

OK, now that I looked at your code, I understand your issue. It's with this line

var appAcademia = angular.module("appAcademia", 
['seblucas.slPageSizeChanger', 'LocalStorageModule', 'ngRoute', 'ngAnimate',     
'ui.bootstrap', 'ui.router', 'ngResource']).config(function ($routeProvider, $stateProvider, $urlRouterProvider,   $httpProvider, $resourceProvider)

You're setting the variable to the module name's config function. Instead do this

var appAcademia = angular.module("appAcademia", 
['seblucas.slPageSizeChanger', 'LocalStorageModule', 'ngRoute', 'ngAnimate',     
'ui.bootstrap', 'ui.router', 'ngResource']);

appAcademia.config(function ($routeProvider, $stateProvider, $urlRouterProvider,   $httpProvider, $resourceProvider)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Richard, I have tried your solution out but I am still getting the same errors

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.