0

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 :)

Lrrr
  • 4,755
  • 5
  • 41
  • 63
  • 1) See http://stackoverflow.com/questions/18287482/angularjs-1-2-injectormodulerr 2) Do you have many questions ? One question -> one question mark – ROMANIA_engineer Feb 03 '15 at 07:41
  • 2
    Are you including the scripttag with `services.js` **before** the scripttag with `app.js`? – Nano Feb 03 '15 at 07:41

1 Answers1

2

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.

Yiling
  • 2,817
  • 2
  • 21
  • 27