Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trigger backbone.js route without changing url

Tags:

backbone.js

Here is my use case:

I have a bunch of images on the page, and each can be rated 1-5 stars. I have a search that allows you to filter by a number of stars, which creates a url fragment like:

mydomain.com/app/#/stars/3

this is all working. Now, lets say I change the rating on one of my images and filter again on 3 stars. Because the url doesn't change my route doesn't fire, and my filtering doesn't occur. I'm using:

window.router.navigate('#/' + url, true);

How would I trigger my routing function when the url doesn't change?

like image 759
Greg Avatar asked Nov 24 '11 07:11

Greg


1 Answers

Try this - Backbone.history.loadUrl()

like image 152
Alexander Hramov Avatar answered Oct 12 '22 20:10

Alexander Hramov