Reputation: 3889
This is my app.component.html
file:
<app-header></app-header>
<router-outlet></router-outlet>
<app-footer></app-footer>
But what I want to do is I want to hide the footer component in /home
route. How can I do that? (Please let me know if putting more code or information is needed?)
Upvotes: -1
Views: 270
Reputation: 1301
You can know that you are in home component from the path:
In app.component.ts
page: string;
//See what is the current page from the path
this.page = this.route.parent.snapshot.url[0].path;
so in app.component.html
<app-header></app-header>
<router-outlet></router-outlet>
<app-footer *ngIf="page != 'home" ></app-footer>
So if you are in home component the footer component it is not rendered.
Upvotes: 1