mercredi 1 juillet 2015

Ember.js - How to resolve a computed property on a child before the child route is activated

I have a Parent-Child-Grandchild relationship that looks like this:

Course
    - has_many Questions

Question
    - has_many Answers

Answer

On my Question model I have a computed property answerCount. When I get to the questions route /courses/1/questions the computed property is evaluated, but not before when I'm in the course route /courses/1.

I want to show users the number of unanswered questions when they enter the course route. But I'm only able to do it at the questions route because that is when the async has_many answers relationship resolves.

How can I get information about the questions has_many answers relationship before the relationship resolves? Or, how can I force the relationship to resolve in the parent route /courses/1?

Please let me know what additional information I can provide.




Aucun commentaire:

Enregistrer un commentaire