Angular $ resource and OData strings like $ skip

I use $ resource in Angular as follows:

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

Now I want to add OData query parameters such as $ filter or $ skip for server-side filtering and swap.

Am I building them using the same technique as query string parameters? Or is there another way?

+6
source share
1 answer

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

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

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

+7
source

Source: https://habr.com/ru/post/977505/


All Articles