Disable SplitPane on specific page

I’m testing the new SplitPane component in v2.2 and it works just fine. But I’m trying to disable the SplitPane on one specific page. When I look at the docs, it looks as if this would be easy, because I can use a boolean in [when].

When I try this in a clean install of a Ionic App (version: 2.2, template: sidemenu), it seems that I can not disable the SplitPane in a Page component.

My app.html :

<ion-split-pane [when]="isLarge">

My page1.ts:

class Page1 {
  public isLarge = false;

This doesn’t work, because the SplitPane is still showing on Page1.

When I put the same boolean variable in my app.component.ts the boolean value works as intended.
My app.component.ts:

class MyApp {
  public isLarge = false;

So, my question is: how can I disable SplitPane on a specific page?

Any help would be greatly appreciated.

Kind regards,
Sybrand Hoeksma

Either make a service that lets you share the hide / show between components, or use two base layouts.

Service is probably simpler, but setting the ‘when’ like that overrides the intended purpose of making the side menu responsive and hiding at a given screen size.

So how do I use two base layouts?? From what I understand, Angular 2 / Ionic 2 does not support dynamic templateUrl.

Check out either of these tutorials. Again this will depend on your use case and how you want to hook it up, but it is definitely possible:

Thanks @rloui for the examples of using multiple layouts. Very interesting. However, for my specific case I followed your first advice and I created a service. I can now enable/disable the SplitPane on every Page Component.

I also ran into another problem, but I managed to solve that as well. The docs say that I can use a media query or a boolean in the [when] statement. But I want to use both, but of course that does not work:

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

So I ended up with checking the screen size in the service, using platform.width()


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


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

export class SplitPaneData {

	splitPaneState: boolean;

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

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

	getSplitPane() {
		return this.splitPaneState;


I’m not sure this is the most elegant solution, but for now, it seems to work as I intended.

1 Like

Hi @hoeksms, you may try adding this:


under constructor of pages you don’t want to have ion-split-pane. Thanks.


thanks jiahao, it works great

thanx for this solution works great for my app with login page, on that page i want to hide the menu! If succes on the redirect page i addthis.menuCtrl.enable(true);

1 Like

This is Ionic 4 I am working with. I just use a variable in a service to control the ion-split-pane. Here it goes:

<ion-split-pane [when]="userData.splitPaneState">


export class UserData {    
   splitPaneState: any;

on entering the page when I wanted split pane hidden and the menu toggle visible:

ionViewWillEnter() {    
  this.userData.splitPaneState = false; 

on exit when I want it revert back to responsive:

ionViewWillLeave() {    
   splitPaneState = 'lg'; 

Try this one - I think it’s pretty easy to handle and clean.


=> GIT: https://github.com/meumobi/meu-starter.tabs-sidemenu.ionic-v4