//service代码
var services = angular.module('guthub.services', ['ngResource']);
services.factory('Recipes', ['$resource', function($resource){
return $resource('/recipes/:id',{id:'@id'}
);
}]);
//controller代码
app.controller('ListCtrl',['$scope','Recipes',
function($scope,Recipes){
$scope.recipes =Recipes;
}]);
//报错信息:Error: [$injector:modulerr] Failed to instantiate module guthub due to: //[$injector:modulerr] Failed to instantiate module guthub.services due to: [$injector:nomod] //Module 'guthub.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.
相关分类