lundi 23 mars 2015

Relation is DS.PromiseMany instead model and data

What I need is: 1) Represent list of partners



App.Partner= DS.Model.extend(
{
name: attr(),
site: attr(),
contacts: DS.hasMany('partner-contact', { async: true, polymorphic: true })
}
);


2) and names of partners contacts



App.PartnerContact = DS.Model.extend(
{
name: attr(),
phone: attr(),
post: attr(),
email: attr(),
partnerId: attr(),
partner: DS.belongsTo('partner')
}
);


So I have route:



App.CallsMyContactsRoute = Ember.Route.extend({
//needs: "partner-contacts",
model: function () {
return this.store.find('partner');
}
});


And template:



{{#each partner in model}}
<tr class="gradeA even" role="row">
<td class="sorting_1">{{partner.name}}</td>
<td>{{partner.name}}</td>
<td>{{partner.phone}}</td>
<td class="center">

{{partner.contacts}}
{{#each contact in partner.contacts}}
{{contact.name}}
{{/each}}
</td>
<td class="center">A</td>
</tr>
{{/each}}


But {{partner.contacts}} is DS.PromiseManyArray And its ever dont make a query to server.


What is the problem?





Aucun commentaire:

Enregistrer un commentaire