How to Receive Meta Data Using ActionModelAdapter

Photo of Piotr Pawlik

Piotr Pawlik

Jun 8, 2016 • 1 min read
emberpusher

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 in the following way:

store.query('item', {}).then((response) => { 
let meta = response.get('meta'); //6
})
Photo of Piotr Pawlik

More posts by this author

Piotr Pawlik

Piotr graduated in Automatic Control and Robotics at the Poznań University of Technology but had...
How to build products fast?  We've just answered the question in our Digital Acceleration Editorial  Sign up to get access

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by:

  • Vector-5
  • Babbel logo
  • Merc logo
  • Ikea logo
  • Volkswagen logo
  • UBS_Home