DS.Adapter#findAll()

findAll (store, type, sinceToken, snapshotRecordArray) Promise

Defined in addon/adapter.js:123

The findAll() method is used to retrieve all records for a given type.

Example

app/adapters/application.js
import DS from 'ember-data';

export default DS.Adapter.extend({
  findAll: function(store, type, sinceToken) {
    var query = { since: sinceToken };
    return new Ember.RSVP.Promise(function(resolve, reject) {
      Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) {
        resolve(data);
      }, function(jqXHR) {
        reject(jqXHR);
      });
    });
  }
});

Parameters:

store DS.Store
type DS.Model
sinceToken String
snapshotRecordArray DS.SnapshotRecordArray

Returns:

Promise
promise
doc_EmberJs
2016-11-30 16:49:23
Comments
Leave a Comment

Please login to continue.