mardi 9 octobre 2018

Use a model to create an object in a component

I'm in Ember 3.4

I can create an EmberObject with

let course = EmberObject.extend({
  duration: null,
  level: null
});

course.create({ duration: '7', level: 'medium' });

But I already have a model for courses, defined in 'app/models/course.js'.

I wonder if I can "import" the model in the component and use it to create the object.




Aucun commentaire:

Enregistrer un commentaire