How can I get the current page name in Onsen 2.0.0 rc.9 ?



  • Hi,

    I was using this method in Onsen 1.x before migration to Onsen 2.0.0 rc.9:

    myNav.getCurrentPage().page;
    

    But the function getCurrentPage().page is not working after migration to Onsen 2.


  • Onsen UI

    @Luis-Guilherme-Pires-Moura I think you’re looking for myNav.topPage.name. Properties are here.



  • if you want it to appear on your toolbar…this should probably work out for you

     <ons-toolbar>
                <div class="left">
                    <ons-toolbar-button ng-click="app.slidingMenu.toggleMenu()"><ons-icon icon="bars" style="color:#fff;" ></ons-icon></ons-toolbar-button>
                </div>
                <div class="center" style="font-size:25px; color:#fff;"> Name</div>
                <div class="right">
          <ons-toolbar-button>Logout</ons-toolbar-button>
        </div>
            </ons-toolbar>
    

Log in to reply