Navigation

    Monaca & Onsen UI
    • Register
    • Login
    • Search
    • Tags
    • Users
    • Blog
    • Playground
    1. Home
    2. via-lars
    V
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    via-lars

    @via-lars

    0
    Reputation
    3
    Posts
    120
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    via-lars Follow

    Posts made by via-lars

    • RE: Imported Onsen UI webpage has no iPhone preview but "This is a template for Monaca app."

      Thank you very much!

      Indeed, my imported files and folders were all put on root level.

      Thanks to https://en.docs.monaca.io/products_guide/monaca_ide/dependencies/file_dir and https://en.docs.monaca.io/products_guide/monaca_ide/dependencies/components I just read before your reply I just got a working iPhone preview!

      posted in Monaca Tools
      V
      via-lars
    • Imported Onsen UI webpage has no iPhone preview but "This is a template for Monaca app."

      Hello,

      i let import a web page “app” built with Onsen UI into Monaca. The iPhone preview shows only “This is a template for Monaca app.”.

      Comparing with the “Hello World” demo project, my Onsen UI web page includes no Cordova / PhoneGap references.

      Due to the note at https://onsen.io/v2/guide/hybrid/cordova.html I was under the impression Monaca lifts off any integration work for me.

      What do I have to do to let Monaca recognise my Onsen UI project as a source for an iOS (and preferrably any other supported plattform) app?

      posted in Monaca Tools
      V
      via-lars
    • RE: Where to place custom.js file for separate html page?

      Hello,

      I came here looking for what I guess is a solution to the same problem.

      ons-navigator supports pushPage(id, options).

      id can be the path and name of a separate (template/)file.

      options can be a JS object passed into that file.

      But how can one specifiy the JS which uses the options in that file? I would use an event like init from https://onsen.io/v2/api/js/ons-page.html#lifecycle (I just remembered the note from https://onsen.io/v2/guide/fundamentals.html#the-ons-object).

      According to the attempts by @LittleOldLady , the JS has to be placed inside the ons-page in that template inline, it cannot be referenced as a separate file from there? I just tested this, referencing a file by src indeed does not work.

      So a solution is to have all code in one or more JS files referenced from index.html and to use a one-liner like
      ons.getScriptPage().onInit = myFunctionCoveringTheCodeForThePageLoadedHere;
      inside the script in that template/file/page inline.
      Or use the

      document.addEventListener('init', function(event) {
        var page = event.target;
        if (page.matches('#id') {    // id as in passed to pushPage()
          myFunctionCoveringTheCodeForThePageLoadedHere();  // Set up page's dynamic content or behavior
        }
      });
      

      way. (Note the listener is bound to document and acts on the bubbled up JS events.)

      Any benefits/tradeoffs you know of you are willing to share?

      posted in Onsen UI
      V
      via-lars