Skip to content

query and queryRecord

Amiel Martin edited this page Dec 18, 2015 · 5 revisions

The entire query from query can be included in the url with {?query*}.

// adapter
queryUrlTemplate: '/posts{?query*}'

store.query('post', { month: 6, year: 2015 });
// => /posts?month=6&year=2015

Or, selective keys from query can be used in the url.

// adapter
queryUrlTemplate: '/blog/{category}{/year,month,day}{?orderBy,orderDir}'

store.query('post', {
  category: 'featured',
  year: 2015,
  month: 12,
  orderBy: 'date',
  orderDir: 'desc',
});

// => /blog/featured/2015/12?orderBy=date&orderDir=desc