DS.Adapter#query()

query (store, type, query, recordArray) Promise

Defined in addon/adapter.js:154

This method is called when you call query on the store.

Example

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

export default DS.Adapter.extend({
  query: function(store, type, query) {
    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
query Object
recordArray DS.AdapterPopulatedRecordArray

Returns:

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

Please login to continue.