这是这个的后续问题如何使用rails服务器在Angular中获取索引数据 https://stackoverflow.com/questions/18312689/how-to-fetch-index-data-in-angular-using-rails-server
Question如何使用 html 正确上传/链接 Angular 模块?
按照接受的答案并更新代码,我无法加载模块用户:
Uncaught Error: No module: users
我的项目的要点是here https://gist.github.com/maro10/6268778
更新的代码:
app.factory('User', function($resource) {
return $resource "users/:id", { id: '@id' }, {
index: { method: 'GET', isArray: true, responseType: 'json' },
show: { method: 'GET', responseType: 'json' },
update: { method: 'PUT', responseType: 'json' }
}
})
var UsersIndexCtrl = function($scope, User) {
$scope.users = User.index();
};
根据接受的答案更新了 plunker 是here http://plnkr.co/edit/NovQxb0a7013GQDFgsvk?p=preview