Friday, September 13, 2013

Backbone URL Won't Update Using .navigate()

Backbone URL Won't Update Using .navigate()

When parameters are passed into my Backbone App, I grab them and save them
to local storage as options, and then the App starts auto-saving the
user's progress as they work. Now, I want to remove the parameters from
the URL, so if the User refreshes the page, they won't have to start all
over.
However, when I use the following code, the URL is not being updated. I
simply want to clear out all of the parameters. And I don't want to run
the Router function again so I've included trigger: false Why doesn't
Backbone allow me to do this?
var newURL = "editor"
App.Router.navigate(newURL, { replace: true, trigger: true });
My Router
routes: {
"" : "browser",
"editor" : "editor"
Sample URL
myapp.com/editor?param1=true&param2=false

No comments:

Post a Comment