Mobile Application and SPA Router

2 posts, 0 answers
  1. Gordon
    Gordon avatar
    1 posts
    Member since:
    May 2013

    Posted 16 Sep 2013 Link to this post


    We have developed a mobile application with remote views, where we are navigating between pages using app.navigate. I am now experimenting with the Router and want to set up a route for, say, '/things/:thingId' which displays the remote view 'views/thing-detail.html' for the correct thing (so we can address that particular page from an email, for instance). My code for the route set up is as follows:
    application.router.route( "/things/:thingId", function ( thingId ) {
        var store = application.managedContext.getEntityStore( "things" );
        store.find( thingId ) // potentially async call which returns a promise to return a thing
        .done( function ( thing ) {
            application.kendoApplication.navigate( "views/thing-detail.html" );
            application.views.thingDetailViewModel.setSelectedThing( thing );
    This works, but when kendoApplication.navigate is called the URL is updated to #views/thing-detail.html, which is not what I want to happen (I want it to stay as /thing/123). In the SPA examples I have read, the views and layouts are constructed programmatically. If I want to use the router in this way, will I have to do the same, or is there a way to have the Router and Mobile Application work together (or am I going about this the wrong way!)?
  2. Petyo
    Petyo avatar
    2437 posts

    Posted 17 Sep 2013 Link to this post

    Hi Gordon,

    As far as I understand your scenario, this approach is not supported, currently. The mobile application is bound to the browser history object (in fact, it uses a router instance internally). Navigating to  a view will cause the URL to change; currently there is no workaround for that. 

    Our future plans include decoupling of the mobile application from the router, so that behavior like that could be supported. However, I can't give you a concrete timeline or details about how this would work. 

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