angularJS 如何操纵 resolve return

angularJS how to manipulate resolve returm

我正在使用 AngularJS 和 RESTAngularJS。 我的决心 return 正确 JSON。例如 "subject"

0: {subjectId: "1", subjectCode: null, subjectLongName: "English", subjectShortName: "English"}
1: {subjectId: "2", subjectCode: null, subjectLongName: "Hindi", subjectShortName: "Hindi"}
2: {subjectId: "3", subjectCode: null, subjectLongName: "Maths", subjectShortName: "Maths"}
3: {subjectId: "4", subjectCode: null, subjectLongName: "Physics", subjectShortName: "Physics"}
4: {subjectId: "5", subjectCode: null, subjectLongName: "Chemistry", subjectShortName: "Chemistry"}

当我分配给时,如下

$scope.SecondItems = subject; 
console.log($scope.SecondItems);

我得到的结果如下

[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, route: "subject", reqParams: null, restangularized: true, fromServer: true, parentResource: null…]


{
  "subjectId":"3",
  "subjectCode":null,
  "subjectLongName":"Maths",
  "subjectShortName":"Maths",
  "subjectDescription":null,
  "route":"subject",
  "reqParams":null,
  "restangularized":true,
  "fromServer":true,
  "parentResource":null,
  "restangularCollection":false,
  "IsSelected":true
}

如何去掉额外的字段,例如

 "reqParams":null,
 "restangularized":true,
 "fromServer":true, 
 "parentResource":null,
 "restangularCollection":false,

或者我做错了什么?

使用 restangular 中的普通方法来摆脱它们。

喜欢: $scope.SecondItems.plain();

https://github.com/mgonto/restangular