I want for my Pages
induvidually to inject different components from other Pages/Components
into the header
. For example I want to inject an Input
search Field from my content-component
into my header
Component. I tried with ng-Content
, but this only duplicates my header
in my HTML
. The problem is my header
is not in each Component
individually, its in my app.component
.
My Header Component:
<div class="header__sub">
<div class="header__title header__title--sub">
<h2 class="title title--medium">{{ subtitle }}</h2>
</div>
<div class="header__search">
<!-- Here should be my Input field -->
<ng-content></ng-content>
</div>
Component from I want to inject the input field:
<app-header>
<mat-form-field>
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Search" />
</mat-form-field>
</app-header>
....
App-Component.html:
<mat-drawer-content>
// The header
<app-header-sub>
</app-header-sub>
<div class="content__inner">
// My Content
<router-outlet></router-outlet>
</div>
</mat-drawer-content>
How can I inject from each Component individually a different tag into the header
(with functionalities)?