Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Ionic 2 - How to remove split panel on login page only?

I use this code in app.html, the split-pane is working beautifully. But the problem is, the pane is working for every page like login or SignUp, so please help me to prevent the split pane working for every page.

<ion-split-pane when="(min-width: 768px)">
<ion-menu [content]="content">
  <ion-content id="Chat">
  </ion-content>
</ion-menu>
<ion-nav [root]="rootPage" #content></ion-nav>
</ion-split-pane>
about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

    import { Component } from '@angular/core';
    import { MenuController,IonicPage, NavController } from 'ionic-angular';

    @IonicPage()

    @Component({
      selector: 'page-signup',
      templateUrl: 'signup.html',
    })

    export class SignUp {

    constructor(public navCtrl: NavController, public menu : MenuController) 
    {   
       this.menu.enable(false);
       this.menu.swipeEnable(false);
    }

    ionViewWillLeave(){
    this.menu.enable(true);
    this.menu.swipeEnable(true);
    }
  }

Hope this helps. just disable menu and swipe the menu with that splitpane automatically hides.

about 4 years ago · Santiago Trujillo Relatório

0

Based on what hoeksms mentioned here, you could use a shared service like this:

import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular';

@Injectable()
export class SplitPaneData {

    splitPaneState: boolean;

    constructor(public platform: Platform) {
        this.splitPaneState = false;
    }

    setSplitPane(state: boolean) {
        if (this.platform.width() > 768) {
            this.splitPaneState = state;
        } else {
            this.splitPaneState = false;
        }
    }

    getSplitPane() {
        return this.splitPaneState;
    }

}

And in the app.component use that service to show/hide it:

<ion-split-pane [when]="splitPaneData.getSplitPane()">

If you want to hide it in a given page, you can use the ionViewWillEnter and ionViewWillLeave lifecycle events:

ionViewWillEnter() {
    // Disable the split plane in this page
    this.splitPaneData.setSplitPane(false);
}

ionViewWillLeave() {
    // Enable it again when leaving the page
    this.splitPaneData.setSplitPane(true);
}
about 4 years ago · Santiago Trujillo Relatório

0

update ionic 5

work for me login.page.ts

  constructor(
    private api: LoginService,
    private loadCt: LoadingController,
    private nav : NavController,
    public menu : MenuController
    ) {
      this.menu.enable(false);
      this.menu.swipeGesture(false)
     }

     ionViewWillLeave(){
      this.menu.enable(true);
      this.menu.swipeGesture(true);
      }
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda