This is a migrated thread and some comments may be shown as answers.

Ordering of routes

1 Answer 28 Views
SPA
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 10 May 2013, 01:30 AM
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

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 13 May 2013, 07:38 AM
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!
Tags
SPA
Asked by
Gary
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or