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:
let result = this.store.query(‘post’, {
limit: 10,
offset: 0
});
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.
{
"post": {
"id": 1,
"title": "Progressive Enhancement is Dead",
"comments": ["1", "2"],
"links": {
"user": "/people/tomdale"
},
// ...
},
"meta": {
"total": 100
}
}
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!!