A model
is a class that defines the properties and behavior of the data that you present to the user. Anything that the user expects to see if they leave your app and come back later (or if they refresh the page) should be represented by a model
.
When you want a new model for your application you need to create a new file under the models folder and extend from Model
. This is more conveniently done by using one of Ember CLI's generator commands. For instance, let's create a person
model:
ember generate model person
This will generate the following file :
app/models/person.js
:
import Model from '@ember-data/model';
export default class PersonModel extends Model {
}