Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Ember metadata


May 09, 2021 Ember.js Reference documents



Metadata is data with a specific pattern or type, not a record.

A common example is pedding. Typically, peddles are set up like the following code:

  1. let result = this.store.query(‘post’, {
  2. limit: 10,
  3. offset: 0
  4. });

Set the display data to 10 per page, but you don't know the total number of bars, and how do you know how many pages there are? That's when metadata will come in use.

  1. {
  2. "post": {
  3. "id": 1,
  4. "title": "Progressive Enhancement is Dead",
  5. "comments": ["1", "2"],
  6. "links": {
  7. "user": "/people/tomdale"
  8. },
  9. // ...
  10. },
  11. "meta": {
  12. "total": 100
  13. }
  14. }

This data is JSON format data returned from the background and can be obtained this.get('meta') metadata. You can even get it from the query() method.

let => of javascript ES6, if you want to learn about javascript ES6 please Google.

The use of metadata in a project is shown in a later example. After introducing Ember Basics, I'll go back to a more complete small project, and I'll use as much of the knowledge as I can in the project, so stay tuned _


The full code of the blog post is placed in Github (the blog post has been modified several times, and the code on the blog post may be different from the github code, but the impact is small!). I f you think the blog post is a bit useful to you, please give me a star on the star project. Yours is definitely the biggest motivation for me!!