2017-04-15 7 views
1

私はイオン2に隠そうとしています。私は<ion-navbar [hidden]="true">を試しましたが、動作しません。Ionic2でnavbarを非表示にする方法

誰でもionic2の条件付きでnavbarを非表示にする方法を教えてもらえますか?

答えて

2

あなたはそれ

<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(); 
    } 
} 
+0

ビンゴ。ありがとうございました。 – raju

+0

喜んで:) – sebaferreras

関連する問題