使用angularjs获得休息服务

时间:2015-07-06 15:46:24

标签: javascript ajax json angularjs rest

我是棱角分明的新人。我试图从具有以下JSON格式的其他服务中获取信息

[{ "participantMemberPK": { "memberId": 1, "participantId": 2 } },
 { "participantMemberPK": { "memberId": 1, "participantId": 8 } },
 { "participantMemberPK": { "memberId": 2, "participantId": 7 } },
 { "participantMemberPK": { "memberId": 3, "participantId": 7 } },
 { "participantMemberPK": { "memberId": 3, "participantId": 8 } },
 { "participantMemberPK": { "memberId": 4, "participantId": 1 } },
 { "participantMemberPK": { "memberId": 5, "participantId": 9 } },
 { "participantMemberPK": { "memberId": 6, "participantId": 10 } }]

我的工厂正在回归:

return $resource(restUrl, {}, {
    get: {
        method : 'GET',
        params : {},
        isArray: true }
    }
};

运行应用程序时出现错误:

Error: a.push is not a function
fa@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:11:302
Resource@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-resource.js:401:9
resourceFactory/</Resource[name]/promise</<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-resource.js:482:19
n@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:7:308
resourceFactory/</Resource[name]/promise<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-resource.js:481:17    
f/<@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:120:98
hf/this.$get</m.prototype.$eval@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:134:387
hf/this.$get</m.prototype.$digest@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:131:419
hf/this.$get</m.prototype.$apply@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:135:159
l@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:87:139
N@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:91:187
Rf/</x.onload@http://127.0.0.1:8020/angularBIOS/scripts/angular.min.js:92:220

有任何帮助吗?感谢

1 个答案:

答案 0 :(得分:0)

请参阅下面的zancudo评论解决方案(这只是一些缺失的行)。