Pregunta

I'm looking at switching from resource to restangular in my AngularJS app. I like the new model, but I have one problem. I can't figure out how to make this API call:

http://localhost:8000/api/entity/groups/1,2,3,4/events

I have code like this:

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');
        }
    }
}];

Is there a way to ask for a set of groups (more than one and not all of them) and then get all events for any of those groups?

¿Fue útil?

Solución

Use several method of Restangular

Restangular.several('accounts', 1234, 123, 12345).customGETLIST('events');

P.S.: I think this might be a bug of Restangular that .getList('events') is not working.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top