I'm currently trying to figure out how to access metadata when using the store.findRecord() call.
The guides ( http://guides.emberjs.com/v2.1.0/models/handling-metadata/ ) say that metadata can be accessed by following these steps:
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 assume that metadata is not set when using findRecord . I am returning a valid JSON API with the top level meta property as follows:
{ "meta": { "page": { "number": 1, "size": 100, "total": 20 }, "data":[ // data here ] } }
Is there a way to access the metadata returned by the server using findRecord () and JSONAPISerializer and JSONAPIAdapters?
Thanks!
I use the following versions:
Ember : 2.1.0 Ember Data : 2.1.0 jQuery : 1.11.3
Sarus source share