cannot load module in angular js

I have simple problem with angularjs

Services.js

'use strict'

var restData = angular.module('ccapp.services', ['ngResource']);

restData.factory('Testcust', function ($resorce) {
    return $resorce('http://localhost:8080/CallCenterRest/webresources/testcust',{},{
       query:{method:'GET', isArray:true} 
    });
});

app.js

var app = angular.module('ccapp', [
    'ngRoute',
    'ccapp.services']);
app.config(function ($routeProvider) {
    $routeProvider
        .when('/viat',
            {
                controller: 'viatctrl',
                templateUrl: 'pages/viat.html'
            })

        .otherwise({ redirectTo: 'index.html' });
});

problem is

Uncaught Error: [$injector:modulerr] Failed to instantiate module ccapp due to: Error: [$injector:modulerr] Failed to instantiate module ccapp.services due to: Error: [$injector:nomod] Module 'ccapp.services' 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.

somebody can help :)

Upvotes: 0

Views: 1262

Answers (1)

Yiling
Yiling

Reputation: 2965

Check the index.html file to ensure that Services.jsis included by a script tag like so <script src="whatever-your-path-is/Services.js"></script>.

If your project was set up such that a grunt or gulp task compiles all javascript files into one file (e.g., my-app.js) to be included in index.html by a script tag, then you need to make sure that this Service.js file is on the path to be processed by the grunt or gulp task.

Upvotes: 2

Related Questions