App.navigate function does not exist

3 posts, 1 answers
  1. Nikolaus
    Nikolaus avatar
    6 posts
    Member since:
    Mar 2017

    Posted 20 Apr Link to this post

    Hi,

     

    I'm trying to navigate within my app, but it seems that the app variable isn't defined in the usual way. I didn't create any of the framework myself (the app is based on the default template), but when I try to use app.navigate, I get an error that that function does not exist. When I checked my app.js, it seems like a custom app is being defined, instead of using app = new kendo.mobile.Application. How do I navigate in my app while keeping my layout page? The nav links on the layout page just use anchor tags (href=view/example.html) but if I try that anywhere else, it obviously opens the page without the layout.

  2. Nikolaus
    Nikolaus avatar
    6 posts
    Member since:
    Mar 2017

    Posted 20 Apr in reply to Nikolaus Link to this post

    For some reason I had to use:

    app.mobileApp.navigate("path/view.html");

  3. Answer
    Martin
    Admin
    Martin avatar
    103 posts

    Posted 24 Apr Link to this post

    Hi Nikolaus,

    I assume your are using the Views service of Telerik Platform. There the mobile app indeed is created not in "app" variable but in "app.mobileApp":

    app.mobileApp = new kendo.mobile.Application(document.body, {
        skin: 'nova',
        initial: 'components/home/view.html'
    });
     
    // navigate to a remote view
    app.mobileApp.navigate("settings.html");

    Therefore you have to use app.mobileApp for all subsequent methods, like navigation. This is the main difference with the documentation on navigation where navigation is the following:

    var app = new kendo.mobile.Application();
     
    // navigate to a remote view
    app.navigate("settings.html");

    I hope this has helped.

    Regards,
    Martin
    Telerik by Progress
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top