Fixing URLs for requested routes

2 posts, 0 answers
  1. Dustin
    Dustin avatar
    79 posts
    Member since:
    Oct 2012

    Posted 23 Jul 2013 Link to this post

    If I register a route for this for example..."/view(/:category)(/:name)" this works just fine..."http://localhost:6699/test/view/home/index". But, if you request "http://localhost:6699/test/view/home/index/" with a trailing slash the route missing is triggered. I tried using regex in the route change event to remove trailing a slash if it exists, but that has no effect b/c after looking at your source code the url you modify in the change event doesn't update back to the url in the caller. So, how can I fix these type of route request or is this a bug with your SPA framework?

    Currently I have to register two routes where one ends w/ a slash and both provide the same callback. But, this is not efficient to have to register two routes for each route needed. So, if I have 25 possible routes, then I have to register 50.

    Or is there a way I can specify and optional trailing slash end the route definition?
  2. Petyo
    Petyo avatar
    2444 posts

    Posted 25 Jul 2013 Link to this post

    Hello Dustin,

    You can use optional segments for that purpose. I prepared a small sample to demonstrate the needed approach.

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