I am currently trying to figure out how to access metadata when using the store.findRecord()
call.
In the guides (http://guides.emberjs.com/v2.1.0/models/handling-metadata/) it says that metadata can be accessed by doing the following:
store.query('post').then((result) => {
let meta = result.get('meta');
})
I was hoping this would work when using findRecord
as well
store.findRecord('book', params.id, {adapterOptions: {query: params}}).then((result) => {
let meta = result.get('meta');
})
However this always returns undefined for the meta
property. I'm assuming that metadata is not being set when using findRecord
. I am returning valid JSON-API with a meta
property at the top level like this:
{
"meta": {
"page": {
"number": 1,
"size": 100,
"total": 20
},
"data":[
// data here
]
}
}
Is there a way to access the metadata returned by the server when using findRecord() and the JSONAPISerializer and JSONAPIAdapters?
Thank you!
I am using the following versions:
Ember : 2.1.0
Ember Data : 2.1.0
jQuery : 1.11.3