Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular $resource and OData strings such as $skip

I am using a $resource in Angular like this:

function classResource($resource) {
    return $resource("/api/classes/:classId");
}

I now want to add OData query options such as $filter or $skip for server-side filtering and paging.

Do I build them using the same technique as with query string parameters? Or is there another way?

like image 887
DeborahK Avatar asked Oct 30 '14 19:10

DeborahK


1 Answers

OK... here is the code I used to build the parameters.

    classResource.query({ $skip: 10, $filter: 'value' },
        function (data) {
            vm.classes = data;
        });

This seems to produce the desired result: "/api/classes?$filter=value&$skip=10"

like image 124
DeborahK Avatar answered Sep 21 '22 18:09

DeborahK