rails app中的Angular get请求无法正常工作

时间:2013-10-15 00:05:49

标签: ajax http angularjs get controller

我正试图在我的一条路线的rails应用程序中制作(我的第一个)角度获取请求。我不确定为什么这不会返回任何内容,甚至不是错误。

function accomplishmentController($scope, $http) { 

$scope.$apply(function() { 
  $http({method: 'GET', url: '/api/users'}).
  success(function(data, status, headers, config) {
    console.log("hell0");
  }).
  error(function(data, status, headers, config) {
    console.log("error");
  });
});
$scope.accomplishments = [];
$scope.submit = function() {
  $scope.accomplishments.unshift({ name: $scope.newAccomp, count: 0 });
  $scope.newAccomp = '';
}
$scope.addToCount = function() {
  var currentcount = this.accomp.count;
  this.accomp.count = currentcount + 1;
}
$scope.delete = function() {
  index = this.$index;
  $scope.accomplishments.splice(index, 1)
}

}

0 个答案:

没有答案