私は、ヘッダーバーを独自のコンポーネントに抽出しようとしましたが、この新しいコンポーネントを使用すると、ヘッダーバーの後ろに表示されるという問題があります。角度2 /イオン含有量がヘッダーの背後にある
ヘッダーを抽出せずにHTML内で同じコードを直接使用することなく正しく動作します。
私の新しいコンポーネント:
ヘッダ-bar.component.ts
import { Component, Input } from '@angular/core';
@Component({
selector: 'my-header-bar',
templateUrl: 'header-bar.html'
})
export class MyHeaderBar {
@Input() pageTitle : String;
constructor() {}
}
<ion-header>
<ion-navbar>
<button ion-button menuToggle icon-only>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>{{pageTitle}}</ion-title>
</ion-navbar>
</ion-header>
私はそれを使用しようとするページのヘッダー、内容でbar.html:
home.html
<my-header-bar pageTitle="Einstellungen"> </my-header-bar>
<ion-content>
<h2>Welcome to Ionic!</h2>
<p>
This starter project comes with simple tabs-based layout for apps
that are going to primarily use a Tabbed UI.
</p>
...
</ion-content>
なぜそれが私自身のコンポーネントでは動作しませんか?