每个视图上都没有离子侧面菜单

时间:2022-11-19 23:44:49

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.

看看下面的plunker。在开始页面“foo”上,您可以看到我们有一个侧面菜单,可以通过单击左上角的图标或从左侧滑动到右侧来打开。

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:

如果您现在按下“下一步”按钮导航到下一个视图“bla”,您会注意到在左上角出现一个新按钮 - 后退按钮。非常好!我希望那样!但我也希望能够在侧面菜单中滑动,但这是不可能的。我想当我实现一个侧面菜单时,它将在所有视图中可访问,我设置如下:

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 个解决方案

#1


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.

它是在那里工作正常,如果添加菜单切换到bla html你可以访问侧面菜单,我发生的是你的离子导航栏自动交换按钮,所以按钮只是消失。可以只使用div和一些类,如bar,bar-stable,以及使用html代码而不是angular指令添加和删除按钮,或者您可以添加另一个按钮来打开和关闭栏右上角的菜单。

<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

#1


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.

它是在那里工作正常,如果添加菜单切换到bla html你可以访问侧面菜单,我发生的是你的离子导航栏自动交换按钮,所以按钮只是消失。可以只使用div和一些类,如bar,bar-stable,以及使用html代码而不是angular指令添加和删除按钮,或者您可以添加另一个按钮来打开和关闭栏右上角的菜单。

<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