Search code examples
user-interfaceonsen-ui

Need a login page without ons-splitter


How can I have a ons-splitter only appearing after the login page?

I have a splitter menu and four more pages, all of them need to open this splitter. But before all of it, I have a login page that I want to prevent the splitter to open (swipeable)


Solution

  • There are 2 common ways through which you can do this:

    1. Using ons-navigator - you can have a navigator with the login page and then load a page with a splitter.

      After that you can just use mySplitterContent.load('oneOf4Pages.html').

    2. Always use mySplitterContent.load('somePage.html'), but by default use something like <ons-splitter-side side="left" collapse>.

      Later when the user logs in you can do:

      mySplitterContent.open(); 
      mySplitterContent.setAttribute('swipeable', 'swipeable');
      // and then continue using 
      mySplitterContent.load('somePage.html');