Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

ons-splitter: calling a link instead of local html file



  • Hi,

    I have an ons-splitter page. Loading the menu with fn.load function.
    It works fine for the local html file.

    But If I call an link, I get the below error.

    onsenui.min.js:2 Uncaught (in promise) Error: "html" must be one wrapper element.
        at Object.util.createElement (onsenui.min.js:2)
        at onsenui.min.js:4
        at <anonymous>
    

    my code:

    index.html

        window.fn = {};
        window.fn.open = function() {
          var menu = document.getElementById('menu');
          menu.open();
        };
        window.fn.load = function(page) {
          var content = document.getElementById('content');
          var menu = document.getElementById('menu');
          content
            .load(page)
            .then(menu.close.bind(menu));
        };
    

    main.html

    <ons-page>
       <ons-splitter>
        <ons-splitter-side id="menu" side="left" width="220px" collapse swipeable>
          <ons-page>
            <ons-list>
              <ons-list-item onclick="fn.load('showit.html')" tappable>
                Search Customer
              </ons-list-item>
              <ons-list-item onclick="fn.load('/xyz/abc.php?user=Y')" tappable>
                Add New Customer
              </ons-list-item>
    

    Thanks for your help!



  • @mmike Instead of calling fn.load, you need to do: window.location.href = '/xyz/abc/php?user=Y';



  • Ok. Thanks !