All Case Studies Design Development Interviews Our Way Project Management

How To Receive Meta Data Using ActionModelAdapter

Problem

When using findAll there is no metadata available for use:

store.findAll('item').then((response) => {
let meta = response.get('meta'); //undefined
})

However, meta is present in the response:

{
"items":
[...],
"meta":
{
total: 6
}
}

 

Solution

As it turns out, findAll method doesn't support metadata. You have to use query method like this:

store.query('item', {}).then((response) => { 
let meta = response.get('meta'); //6
})
Follow Netguru
Join our Newsletter

READ ALSO FROM Ember.js
Read also
Need a successful project?
Estimate project or contact us