Ive got a resource-route (question) which contains two regular routes (say work and result). So in my result route, I want to place a button/link to the next resource link. For example on http://ift.tt/1tgr6oc
a link should appear which links to http://ift.tt/1Da8GFV
.
So in my template for result, I wrote a helper like {{#link-to 'question.work' getNextQuestionID}}
which uses the method in result-controller and looks like that
getNextQuestionID: function() {
return (parseInt(this.model.get("id")) + 1);
}.property()
This works (because model is the "parent"-question-model). The think is: This only works one time! I quess its because the index.html ist loaded with all templates at once and get filled up with the result of that function exactly one time. So when switching between the templates "work" and "result" there is no reload of that question and the value is always 2 (when starts with question 1).
How can I implement logic, which is reuseable every "call" not only when the template is loaded?
Aucun commentaire:
Enregistrer un commentaire