vendredi 24 avril 2015

ember-data and get function to dig into async models is not working

i prepared a jsfiddle sample: http://ift.tt/1Ge5JUK

I get a ember-data model "RegisteredFighter" and want to access on that model the "RegisteredFighter" property.

then i get an object with and all the other ember-data properties:

{
id: "3"
_data: {
    id: 3,
    Fighter:  3,
    FightRule:  1,
    WeightClass: 1,
    FightClass: 1
}
}

in the example: this.get("item") works fine

this.get("item").get("Fighter") returns unknown
this.get("item").get("Fighter").get("Name") returns unknown

In the handlebar template i can access the Birthday of a Fighter easily. Why not per script ? Is this a problem on my side or from ember-data???

Accessing it per:

this.item.store.find('Fighter', 3).then(function(data) {
    alert(data.get("Name"))
});

works fine to per script.

Please help!

Kind Regards Markus




Aucun commentaire:

Enregistrer un commentaire