Limit and Offset data results in AngularJS for Pagination

后端 未结 3 1233
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 11:06

Does AngularJS have Limit and Offset request methods when calling an external data resource that supports them?

I imagine there is a more elegant solution than this,

3条回答
  •  别那么骄傲
    2020-12-28 11:38

    AngularJs is clientside. It is the external data resource's provider who should support those parameters.

    A possible solution for your problem could be $resource (or the params option Mark mentioned):

    var UserAccounts = $resource('/useraccounts/:userId/limit/:limit/offset:offset', {userId:'@id'});
    var accounts = User.get({userId:123, limit:10, offset:10}, function() {
    });
    

    Of course, server side will need to read the parameters differently.

提交回复
热议问题