我有一个REST服务,我想使用我的角应用程序。我在代码中添加了2个更改,导致异常。
[$injector:modulerr] Failed to instantiate module xxx due to:
Error: [$injector:modulerr] Failed to instantiate module xxx.pages due to:
Error: [$injector:modulerr] Failed to instantiate module Profile due to:
Error: [$injector:nomod] Module 'Profile' 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.
服务/ service.js
angular.module('xxx.services', ['ngResource'])
.factory('Profile', ['$resource',
function($resource){
return $resource('/api/v1/profile', {}, {
query: { method:'GET' }
});
}]);
页/ pages.js
angular.module('xxx.pages', ['xxx.grandfather', 'Profile'])
.config(function ($stateProvider) {
$stateProvider
.state('app.admin', {
url: '/admin',
templateUrl: 'cmp/pages/admin.tpl.html',
accessLevel: accessLevels.admin
})
.state('app.user', {
url: '/user',
templateUrl: 'cmp/pages/user.tpl.html',
controller: 'UserController',
accessLevel: accessLevels.user
});
})
.controller('UserController', function ($scope, Profile) {
$scope.profile = Profile.query();
});
我厌倦了所有google结果: