Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger same location route

Is there a way to trigger same location route in backbone.js, for example when location is /My/App/#/About and user clicks again on anchor with the same route in order to refresh the page content.

like image 249
yojimbo87 Avatar asked Dec 18 '11 09:12

yojimbo87


1 Answers

Backbone.history.loadUrl(Backbone.history.fragment);

The solution for your specific problem isn't really documented and it seems the suggested best practice is to just call the function that is declared in the route you want to fire :/

Ref: https://github.com/documentcloud/backbone/issues/1214

So far the other answers are correct, but they forgot to mention that if the hash navigated to is the same as the current hash, nothing will fire.

like image 164
eddywashere Avatar answered Oct 01 '22 11:10

eddywashere