无法在 angular js 中加载模块

cannot load module in angular js

我有一个简单的问题 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' });
});

问题是

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.

有人可以帮忙 :)

检查 index.html 文件以确保 Services.js 包含在像 <script src="whatever-your-path-is/Services.js"></script>.

这样的脚本标签中

如果您的项目设置为 grunt 或 gulp 任务将所有 javascript 文件编译成一个文件(例如,my-app.js)以包含在 index.html,那么你需要确保这个 Service.js 文件在 grunt 或 gulp 任务要处理的路径上。