samedi 17 octobre 2015

Passing ember-data model to component and getting weird result

ember@2.1.0 
ember-data@2.1.0

I am passing a simple model to a component but getting the following object (I looks like the actual ember-data model is under the value property). Why is model pointing to this instead of the actual model?

enter image description here

Route

export default Ember.Route.extend({

  model() {
    return this.store.createRecord('employee');
  }

})

Template

{{log model}} {{!-- logging here correctly displays the ember-data object --}}
{{my-component model=model}}

Component (my-component)

export default Ember.Component.extend({
  layout,

  didReceiveAttrs() {
    console.log(this.attrs.model); //Prints the Object above
  }

});




Aucun commentaire:

Enregistrer un commentaire