Transition to the same route: how to re-enter to the same path?

I am implementing what it can be understood as a slideshow.

I have a route called next-slide and in this route the next slide is calculated and shown. My intention is that when I call this.transtionToRoute('next-slide') the next slide is calculated again and shown… and so on.

The problem is that the default behaviour of Ember when you make a transition to the same route is to do nothing.

I would like to invoke everything so a new slide can be calculated. Also I would like to use some liquid-fire animations so I would like to be able to use transitions.

(The slideshow reference is an example to simplify the context)

Hi. I think you did’t get what a route is. maybe if you nav between the subroutes /slideshow/1…2…3…4 or implement a action next-slide that change current model of a component are good options to solve this.

Thanks @heatbr for the suggestions.

I can not use the slideshow/{1,2,3,...} option because I don’t want the User to play around with the path and access to an element he has not access yet.

The next-slide action that change the model can be a solution but then I don’t know how to use the benefits of the liquid-fire animations.

My question remains, it is not the first time I am trying to re-enter the path in the one I am, for different reasons.

No matter what you do, a savvy user will be able to access an element unless you have some server-side mechanism to prevent him from doing so. For starters, he may have ember debugger plugin in his browser.

Still, you may just detect, in the beforeModel hook, whether to actually let the model load or show an error / redirect to previous model.

The concept of re-entering a path has no meaning in Ember, that’s just not how paths work. Not to mention it would have a lot of edge cases impossible to account for in a generic way. For instance, what if the user refreshes the page? Or copy-pastes the url to another browser/another computer?

1 Like