trouble with pushPage();

  • Hi, I am having trouble with pushPage();, see:

    If you click the + button you should be able to see a new page with back button, but it doesn’t work.

  • @123php, you need to wrap your first page with <ons-navigator> which you are missing yet referencing in your code!

    Here is a jsFiddle

    <ons-navigator id="myNavigator">
                <div class="right"><ons-toolbar-button onclick="document.querySelector('#myNavigator').pushPage('thread.html', {data: {title: 'Neuer Post'}});">
              <ons-icon style="color:black;" icon="ion-plus"></ons-icon>
                <div class="center">Echo</div>
            <ons-tabbar swipeable position="auto">
                <ons-tab page="tab1.html" label="Home" icon="ion-home, material:md-home" active>
                <ons-tab page="tab2.html" label="Einstellungen" icon="md-settings">
    <template id="tab1.html">
            <ons-page id="Tab1">
                <ons-pull-hook id="pull-hook">
                    Nach unten ziehen um neu zu laden
                    <div id="content"></div>
                    <div id="threads"></div>
        <template id="tab2.html">
            <ons-page id="Tab2">
                <p style="text-align: center;" id="usernamediv"></p>
                <p style="text-align: center;">
                    <ons-button id="logout" name="logout" onclick="logout();">Logout</ons-button>
        <template id="thread.html">
            <ons-page id="NewPost">
               Page got pushed

Log in to reply