- EmberJS - Home
- EmberJS - Overview
- EmberJS - Installation
- EmberJS - Core Concepts
- Creating and Running Application
- EmberJS - Object Model
- EmberJS - Router
- EmberJS - Templates
- EmberJS - Components
- EmberJS - Models
- EmberJS - Managing Dependencies
- EmberJS - Application Concerns
- EmberJS - Configuring Ember.js
- EmberJS - Ember Inspector
EmberJS - Handling Metadata
Metadata is a data that is used for specific model or type instead of using record. The total number of records of the server will be stored in the metadata.
{
"post": {
"id": 1,
"type": "type_name",
"attributes": {
"name": "group_name",
"city": "city_name"
}
// ...
},
"meta": {
"total": 100
}
}
In the above code, meta represents the number of records in the store. The metadata can be accessed by using the following method −
store.query('post').then((myresult) => {
let meta = myresult.get('meta');
})
The above process can be done by calling the store.query() method on the myresult. The total number of pages can be calculated by using meta.total.
emberjs_model.htm
Advertisements