离子 - 如何只登录页面上删除sidemenu? [英] Ionic - How to remove sidemenu on login page only?

查看:151
本文介绍了离子 - 如何只登录页面上删除sidemenu?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除sidemenu只在我的登录页面。否则依然存在。如何可以做到?我使用的命令离子离子开始对myApp sidemenu 来创建项目。

app.js

 的.config(函数($ stateProvider,$ urlRouterProvider){
  $ stateProvider    .STATE('登陆',{
      网址:/登录
      templateUrl:模板/ login.html的
      控制器:'LoginCtrl
    })    .STATE('应用',{
      网址:/应用程序
      摘要:真实,
      templateUrl:模板/ menu.html
      控制器:'AppCtrl
    })    .STATE('app.search',{
      网址:/搜索,
      观点:{
        menuContent:{
          templateUrl:模板/ search.html
        }
      }
    })

登录页

 <离子视图标题=登陆GT&;
  <离子含量>
      < D​​IV CLASS =清单>
        <标签类=项>
          <按钮类=按钮按钮按钮块阳性类型=提交NG点击=登录()>登录上述< /按钮>
        < /标签>
      < / DIV>  < /离子含量>
< / DIV>


解决方案

你可以做的是一个没有sidemenu定义登录页面。检查您的登录页面的HTML模板。确保你没有<离子侧菜单> <离子侧菜单> 在它的元素。这些都是需要有一个sidemenu的页面上使用。

您的登录页面应该是这样的:

 <离子视图>
  <离子含量>
     <! - 您的网页内容中去这里 - >
   < /离子含量>
< /离子视图>

要对其他网页sidemenu,只是把父状态sidemenu含量在code是应用状态。

您menu.html文件:

 <离子视图>
  <离子侧菜单>
    <离子侧菜单>
      <! - 把你的侧面菜单的内容在这里 - >
      <! - 应用程序的任何一个孩子的状态将继承此sidemenu - >
    &所述; /离子侧菜单>   <离子侧面菜单内容>
      <离子导航视图名称=menuContent>< /离子NAV-视图>
   < /离子侧面菜单内容>
  < /离子侧菜单>
< /离子视图>

I need to remove sidemenu only on my login page. Otherwise remain. How it can be done? I'm using command ionic ionic start myApp sidemenu to create the project.

app.js

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

    .state('login', {
      url: "/login",
      templateUrl: "templates/login.html",
      controller: 'LoginCtrl'
    })

    .state('app', {
      url: "/app",
      abstract: true,
      templateUrl: "templates/menu.html",
      controller: 'AppCtrl'
    })

    .state('app.search', {
      url: "/search",
      views: {
        'menuContent' :{
          templateUrl: "templates/search.html"
        }
      }
    })

login page

<ion-view title="Login">
  <ion-content>
      <div class="list">
        <label class="item">
          <button class="button button-block button-positive" type="submit" ng-click="login()">Log in</button>
        </label>
      </div>

  </ion-content>
</div>

解决方案

What you can do is define the login page without a sidemenu. Check your login page HTML template. Make sure you do not have the <ion-side-menus> and <ion-side-menu> elements in it. These are used on pages that need to have a sidemenu.

Your login page should look like this:

<ion-view>
  <ion-content>
     <!--your page content goes in here-->
   </ion-content>
</ion-view>

To have sidemenu on other pages, just put the sidemenu content in a parent state which in your code is the app state.

Your menu.html file:

<ion-view>
  <ion-side-menus>
    <ion-side-menu>
      <!--put your side menu content here-->
      <!--any child state of app will inherit this sidemenu-->
    </ion-side-menu>

   <ion-side-menu-content>
      <ion-nav-view name="menuContent"></ion-nav-view>
   </ion-side-menu-content>
  </ion-side-menus>
</ion-view>

这篇关于离子 - 如何只登录页面上删除sidemenu?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆