mardi 5 juin 2018

Accessing relationship field in emberjs template?

Here is the current structure that i have on my emberjs model

import DS from 'ember-data';

export default DS.Model.extend({
  team: DS.belongsTo('team'),
  opponent: DS.belongsTo('team'),
  type: DS.attr('string'),
});

and the template that i am calling it from is as follows

  <div class="container">
    
      <div class="match">
        <code>Match type : </code>
        <p>Team 1 : </p>
      </div>
    
  </div>

Now the match.team returns me a promise. My question is how do i render the name on template side.

The team with proper id was already populates with model api call as relationship.




Aucun commentaire:

Enregistrer un commentaire