如何在 Ionic2 中隐藏导航栏
How to hide navbar in Ionic2
我想隐藏在 Ionic 2 中。我试过 <ion-navbar [hidden]="true">
但它不起作用。
谁能告诉我如何在 ionic2 中有条件地隐藏导航栏?
您可以使用 属性 从您的组件到 hide/show 它
<ion-navbar *ngIf="showNavbar">
并且在您的组件代码中:
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Content) content: Content;
public showNavbar: boolean;
// ...
public hideNavbar(): void {
this.showNavbar = false;
// You should resize the content to use the space left by the navbar
this.content.resize();
}
}
我想隐藏在 Ionic 2 中。我试过 <ion-navbar [hidden]="true">
但它不起作用。
谁能告诉我如何在 ionic2 中有条件地隐藏导航栏?
您可以使用 属性 从您的组件到 hide/show 它
<ion-navbar *ngIf="showNavbar">
并且在您的组件代码中:
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Content) content: Content;
public showNavbar: boolean;
// ...
public hideNavbar(): void {
this.showNavbar = false;
// You should resize the content to use the space left by the navbar
this.content.resize();
}
}