I've got my router and routes set up, and now I'm trying to implement the navigation, but router.navigate isn't updating the URL and I'm not sure why.
There's a link on my page that's meant to pull up a different view; the onclick for the link is bound to the navigatePage function:
function
navigatePage(page) {
var
category_id = page.data(
"categoryid"
);
var
page_id = page.data(
"pageid"
);
router.navigate(
"/category/"
+ category_id +
"/page/"
+ page_id);
}
This is the route it's going to:
router.route(
"/category/:categoryid/page/:pageid"
,
function
(categoryid, pageid) {
openPage(categoryid, pageid);
});
Which then calls the function to actually change the views. However, when I run the page, I can see (via console.log) that navigatePage is being called, then the route, but the URL never changes and the default route kicks in (I'm assuming because the URL hasn't been modified?).
So I went to record what I was seeing for you, and noticed that the URL is actually changing (you can see it blip in the vid), but the somehow it's being reset. I don't have any other navigate calls in my javascript. Here's the default route, in case that's relevant:
router.route(
"/"
,
function
() {
generateView();
});
Where am I going wrong?