0
我试图渲染采用了棱角分明我的所有用户的列表,但我得到一个500内部服务器错误,当我尝试加载users.json
。的getJSON 500(内部服务器错误)
这是我的服务, angular.module( '用户')
.factory('UsersFactory', ['$http', function($http) {
return {
loadUsers: function() {
return $http.get('/users.json');
}
};
}])
这是控制器, angular.module( '用户',[])
.controller('UserListCtrl', [
'$scope', 'UsersFactory',
function ($scope, UsersFactory) {
var init = function(){
UsersFactory.loadUsers().then(function(response) {
$scope.users = response.data;
console.log ($scope.users)
});
}
init();
}
]);
而我尝试渲染用户的模板,
Users
.user_container{"ng-repeat" => "user in user"}
{{ user.name }}
而这是错误在我的rails服务器输出,
Completed 500 Internal Server Error in 27ms (ActiveRecord: 22.9ms)
ActionView::MissingTemplate (Missing template users/index, application/index with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :haml, :jbuilder]}. Searched in:
* "/home/alucardu/sites/movieseat/app/views"
* "/home/alucardu/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.2/app/views"
):
错误与您的服务器端代码和角码有关,因此您最好将服务器端代码并从问题 – harishr
@entre中移除js代码感谢您的输入。使感觉。你能帮我设置控制器和路线来解决这个问题吗? –
抱歉,但我不知道ror如此无法帮助 – harishr