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.

How do I put pushPage in a if statement



  • Hi guys,
    So I want to make an if statement to see if a user is logged in. If they arent I want to push page a template IDd as “login.html” for some reason I can put it on a button but not in an if statement?
    I have tried:

    if (user == 1){
    document.querySelector('#navigator').bringPageTop('login.html', { animation: 'slide' });
    }
    

    Also

    const loadPage = (page) => {
          document.querySelector('#navigator').bringPageTop(page, { animation: 'slide' });
        };
    if(user === 1){
          loadPage('login.html');
        }
    

    and a few others