node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

loopback-datasource-juggler-paginate

loopback-datasource-juggler-paginate

Loopback Datasource Juggler plugin that adds findPaginate method to Model.

Currently expects query params as given by [ng-table], and provides an object intended to be used by the same.

Usage

/**
  *
  * @param {Object} Query params
  * @param {[Object]} Optional query to be lodash.extend'ed onto the pagination query
  * @return {Promise}
  */
Model.findPaginate(req.query, {
  where: {
    status: {
      neq: 'Deleted'
    }
  }
}).then(function(models) {
  console.log(models);
});

[1] https://github.com/esvit/ng-table