Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to instantiate ng app

I have the following app.js and its unable to invoke the app with modules. attached screenshot of folder structure and code:

core.module.js:

(function() {
    'use strict';

    angular
        .module('app.core');
})();

(function () {
    'use strict';
   
    angular
        .module('app', [
            'ngRoute',
            'ngCookies',
            'ngAnimate',
            'ngResource',
            'ngCookies',
            'ngTouch',
            'app.core',
            'app.events'
        ])
        .config(config);
        
    config.$inject = ['$routeProvider', '$locationProvider', '$httpProvider'];
    function config($routeProvider, $locationProvider, $httpProvider) {
        $routeProvider
            .when('/', {..}..

Uncaught Error: [$injector:nomod] Module 'app.core' 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.
enter image description here
like image 798
Smitha Avatar asked Dec 04 '25 13:12

Smitha


1 Answers

You need the second param on angular.module();

See Document

// Create a new module

var myModule = angular.module('myModule', []);

angular
    .module('app.core',[]);
like image 109
Yin Gang Avatar answered Dec 07 '25 03:12

Yin Gang