Ionic side menu not present on each view

不问归期 提交于 2020-01-17 05:48:08

问题


Take a look at the following plunker. On the start page "foo" you can see that we have a side menu which opens by clicking the icon on the top left corner or by sliding from left side to right side.

If you now press on the "next" button to navigate to the next view "bla" you will notice that at the left upper corner a new button appears - the back button. Thats good! I want that to be like that! But i also want to be able to slide in the side menu but it is not possible. I thought when i implement a side menu it will be accessable throughout all views where i set the like the following:

angular.module("starter.bla", [])

.config(function($stateProvider, $urlRouterProvider) {
    $stateProvider.state('app.bla', {
        url: "/bla",
        views: {
           'menuContent': {
                templateUrl: "bla.html"
            }
        }
    });
});

So what is going on here? As i said i like to have the back button but i also want to be able to slide in the side menu. Until now it is just possible from the starting page.


回答1:


it is there and working correctly, if add menu toggle to the bla html you can access the side menu, what i happening is the your ion-nav bar is swapping out buttons automatically so the button is just disappearing. can can just use a div and some classes like bar, bar-stable, and add and remove buttons with html code instead of a angular directive or you can add another button to open and close the menu on the top right of the bar.

<ion-view view-title="bla">
  <ion-content>
    <div class="card">
      <button class="button button-icon" menu-toggle="left">
        Bla
      </button>
    </div>
  </ion-content>
</ion-view>

http://plnkr.co/edit/IIvBGEMdbYEFfVYrJLia?p=preview



来源:https://stackoverflow.com/questions/31571452/ionic-side-menu-not-present-on-each-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!