First time building an Ember app and I'm having difficulty with my models not resolving.
I have a set of Course models, each of which has an array of User models (hasMany, with async: true).
When I load the page, I see all of the API requests are correct (i.e. the client is making requests for all of the users in the array), and when I log the course model (i.e. when I do console.log(course)
), I see the data in the console. However, when I do something like course.get('admins')
, the array is empty.
The Course is not the model of the controller that needs all of this information (could this be why this is happening?), so I put the 'course' controller in the needs
array.
In the end it's something like this:
var course = this.get('controllers.course').get('model'); // this is OK, has data
var admins = course.get('admins'); // this is not OK, has no data!
Even when I try something like:
course.get('admins').then(function (admins) {
console.log(admins);
});
There's still no data! What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire