lundi 17 octobre 2016

Not able to correctly display ember data from firebase

I am creating an Ember project, I have some data stored in Firebase that i'm trying to display on the screen, this works fine for one property but for the other I get this message each time I do 'player.teams'.

<DS.PromiseManyArray:ember500>

Here is my model

import DS from 'ember-data';
import Faker from 'faker';

export default DS.Model.extend({
  name: DS.attr('string'),
  teams: DS.hasMany('team'),

  randomize(team) {
    this.set('name', Faker.company.companyName());
    this.set('team', team);
    return this;
  }
});

Here is my route

import Ember from 'ember';

export default Ember.Route.extend({

  model() {
    return this.store.findAll('player');
  }
});

and here is my template

<h1>Players</h1>

<table class="table table-bordered table-striped">
  <thead>
    <tr>
      <th>Name</th>
      <th>Team</th>
    </tr>
  </thead>

  <body>
    
    
      <tr>
        <td></td>
        <td></td>
      </tr>
    
  </body>
</table>

Can anyone point me in the right direction?




Aucun commentaire:

Enregistrer un commentaire