Evil Trout
Evil Trout

Reputation: 9634

Forcing EmberJS to route to the same URL

I've noticed that the router in EmberJS refuses to call connectOutlets when you request the same path that you're on.

I think I understand why this happens - if the path does not change, why change anything?

However, I have a dynamic list of items, and I want them to refresh when the user clicks the tab at the top, even if it's the same tab they're currently on.

Is there a way to force EmberJS to call connectOutlets or otherwise notify me when the URL goes to the same path?

Upvotes: 2

Views: 823

Answers (1)

Peter Wagenet
Peter Wagenet

Reputation: 5056

You can only re-enter the current state if you pass different contexts. Otherwise, you'll have to exit the state. In your case, maybe you could make a conditional in your template that change the action to call refresh instead of trying to transition to the same state. Alternatively, you could try some hacks with a randomly generated context that you just ignore later.

Upvotes: 5

Related Questions