Ordering of routes

2 posts, 0 answers
  1. Gary
    Gary avatar
    62 posts
    Member since:
    Sep 2013

    Posted 09 May 2013 Link to this post

    My app sets up several routes and then starts the router. I have a scenario now in which I'm loading additional code on demand, which requires its own routes. I need the new routes to be inserted at the beginning of the route collection because they handle more specific cases than what was added initially.

    I got it working using the following code:
    _router.route(route, callback);
    _router.routes.unshift(_router.routes.pop());
    Is this the recommended approach?

    Thanks,
    Gary
  2. Petyo
    Admin
    Petyo avatar
    2438 posts

    Posted 13 May 2013 Link to this post

    Hi Gary,

    This approach should work, although it relies on the undocumented routes field, which may (though unlikely) be refactored and changed in future releases. 

    Regards,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top