I just started learning ember and i face this scenario: In my edit page, I want to navigate away from it (i.e clicking a link on the menu) but by doing so a pop up dialog will show to confirm my decision and if I click on “Leave” button it will redirect to the list page. This is the current behavior. But what I want is to capture the link that was clicked and transition to that link after clicking the “Leave” button. Any thoughts?
Sure. In your route, implement the willTransition
action. The action handler receives an transition object as argument. You can call .abort()
on it to abort the transition, do some other things, then call .retry()
on the object to restart the transition. You can even attach additional info with your retry by attaching it to .data
property on the transition object.
1 Like