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

Mobile Application and SPA Router

1 Answer 114 Views
Application
This is a migrated thread and some comments may be shown as answers.
Gordon
Top achievements
Rank 1
Gordon asked on 16 Sep 2013, 10:43 AM
Hello,

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!)?

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 17 Sep 2013, 07:04 AM
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. 

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Application
Asked by
Gordon
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or