mardi 6 janvier 2015

How to add dynamic dropdown to template without changing model?

So I had a route: /tournaments/setup/:tournament_id in my ember app, and it displayed various fields from a model.


But then I find that I'll need other models on the same page. For example, suppose I want the list of all players, so that I can make a dropdown for selecting players to join a tournament.


I can pass an object:



this.transitionTo('tournaments.setup', {tournament: tournament, players: players});


and that works once I change the handlebars template to reflect the change of context.


But now the URL is wrong. The URL is /tournaments/setup/undefined. I'm sure there is a way to explicitly handle this also, but I don't know what it is ...


... and I feel like I'm losing the path. Is there a more conventional way to do what I'm doing?





Aucun commentaire:

Enregistrer un commentaire