Router Not Updating URL

2 posts, 0 answers
  1. Ashleigh L
    Ashleigh L avatar
    113 posts
    Member since:
    Jun 2012

    Posted 08 Oct 2015 Link to this post

    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 ="categoryid");
        var page_id ="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() { 

    Where am I going wrong?

  2. Plamen Lazarov
    Plamen Lazarov avatar
    135 posts

    Posted 12 Oct 2015 Link to this post

    Hello shimmoril,

    I am afraid the provided information is not sufficient to determine what exactly goes wrong. In order to better assist you, we will need a runnable demo which demonstrates your exact setup. This will allow us to investigate the issue locally and determine the root cause for the observed behavior. 

    Thank you for your cooperation. 

    Plamen Lazarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top