mardi 9 mai 2017

Is it possible to perform a full, real transition to another route and transition back in Ember?

I am running into trouble when transitioning away from a route and then back to it not resulting in full transitions in Ember.

To be more concrete, I have a route game.new that handles setting up a new game and then this transitions to game.play. The user doens't need to do anything, and so the transition happens automatically in the afterModel hook. However, once a game is over, I would like to start a new game by transitioning back to game.new and then automatically transitioning back to game.play. However, if I have the following hook in app/routes/game/new.js:

afterModel() {
  this.transitionTo('game.play', game);
}

This has the effect of not fully completing the transition and thus the game/play route is not fully torn down and set up again.

Is there a way to fully transition from game.play to game.new and then automatically transition back to game.play so that all the content in game.play is torn down and recreated?




Aucun commentaire:

Enregistrer un commentaire