RestAngular获取JSON对象的数组

red*_*rom 2 javascript json angularjs restangular

我正在尝试使用restangular从服务器获取JSON响应.

  var baseAccounts = Restangular.one('getAllCustomers');
  baseAccounts.getList().then(function(customers) {
      $scope.myData = customers;
      console.log(customers);
    });
Run Code Online (Sandbox Code Playgroud)

问题是我总是得到以下格式的响应:

0: Object
1: Object
2: Object
addRestangularMethod: function bound() {
all: function bound() {
allUrl: function bound() {
clone: function bound() {
customDELETE: function bound() {
customGET: function bound() {
customGETLIST: function bound() {
Run Code Online (Sandbox Code Playgroud)

但我想只返回纯粹的JSON结构.如果有人在这里放置RestAngular插件的例子,我会很高兴.

谢谢你的帮助.

小智 5

为简单起见,您可以使用Restangular 1.4并在响应上链接plain()函数

baseAccounts.getList().then(function(customers){
 $scope.myDate = customers.plain();
Run Code Online (Sandbox Code Playgroud)

});