mardi 29 mars 2016

Ember: this.modelFor is not a function (in component)

Question about the Ember method modelFor

My attempts to use this in a component have failed:

//info component

model(params){
return this.store.createRecord('info'); 
},

user: this.modelFor('user'),

this code breaks the entire app with the following error:

ember.debug.js:4875 Uncaught TypeError: this.modelFor is not a function

I find myself often wanting to use methods in components, or wanting to access multiple models in my component logic -- does anyone know a good resource to educate myself on these best practices?

Thanks!




2 commentaires:

  1. In your component you can pass the model or multiple models.
    {{my-component model=model model2=model2}}

    RépondreSupprimer
  2. In your component you can pass the model or multiple models.
    {{my-component model=model model2=model2}}

    RépondreSupprimer