jeudi 13 septembre 2018

Store and go back to an Ember route

On an Ember app, I am implementing a Wizard. It is composed of several steps (each step has its own route).

I want to store the route from which the user start the Wizard (with its model and query params if any). At the end of the Wizard, I want to redirect the user to the initial route.

For example:

/myapp/some/route   --> click on a link to start the wizard
/myapp/wizard/step1
/myapp/wizard/step2
/myapp/wizard/step3 --> click to end the wizard
/myapp/some/route   --> the initial page

How can I do that?

In the beforeModel(transition) of the Wizard step 1, I found that:

  • this.get('router.currentRouteName') give me the name of the previous route
  • this.modelFor(previousRoute) give me the model
  • this.paramsFor(previousRoute) give me the params

But, I do not find how to replay the transition backward, or to recreate a transition to go back to the initial route.




Aucun commentaire:

Enregistrer un commentaire