我正在考虑在我的 AngularJS 应用程序中从资源切换到 restangular。我喜欢新型号,但我有一个问题。我不知道如何进行此 API 调用:
http://localhost:8000/api/entity/groups/1,2,3,4/events
我有这样的代码:
var GroupService = ['Restangular', function (Restangular) {
var restAngular = Restangular.withConfig(function (Configurer) {
Configurer.setBaseUrl('/api/entity');
});
return {
getEvents: function (groupIds) {
return restAngular.all('groups', groupsIds).getList('events');
}
}
}];
有没有办法请求一组组(多个而不是全部),然后获取这些组中任何一个的所有事件?
最佳答案
使用Restangular的几种
方法
Restangular.several('accounts', 1234, 123, 12345).customGETLIST('events');
P.S.:我认为这可能是 Restangular 的一个错误,.getList('events')
无法正常工作。
关于javascript - GET 中的 Restangular 多个 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21101471/