Ember way to handle form steps

I have a 3 step form in order to create my model . I have “previous” and “next” buttons to transition to each view as needed. Currently the logic I have written works, however it is far from ideal. I am basically tracking the step count with next and back, and transitioning to the appropriate view. This was the first pass, and I succeeded. However I want to improve my code now. What would be the Ember way to do this?

I’m not sure about your current implementation (JSBin?), but in general I would say:

  • Create a separate route for each step, so that it’s tracked in the url,
  • If all the steps contain the same model, you can pass it in the link-to: {{link-to 'Next' model}}
  • If you need saving or rollback of the model data on form transitions, use the Route#willTransition hook
1 Like