当我尝试加载此控制器时:
.controller('UserEditController',function($scope,$state,$stateParams,User){
$scope.updateUser=function(){
$scope.user.$update(function(){
$state.go('users');
});
};
$scope.loadUser=function(){
$scope.user=User.get({id:$stateParams.id});
};
$scope.loadUser();
});
我在Chrome中遇到此错误:
Error: [$resource:badcfg] http://errors.angularjs.org/1.5.7/$resource/badcfg?p0=get&p1=object&p2=array&p3=GET&p4=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fusers
答案 0 :(得分:1)
尝试使用查询而不是get:
$scope.user = User.query({id:$stateParams.id});