I have a header that I want to hide on certain routes
When your on the home there is nothing next to the route so www.mywebsite.com
but then when you log in the route will always have app
in it so every page from now on will look like this www.mywebsite.com/app/whatever
basically I want to hide my header when the route has app
in it
I have tried to do this.. but It doesnt seem to be working
Any help would be appreciated and if you know a better way to do this please let me know!
component.html
<home-header *ngIf="router != '/app'"></home-header>
component.ts
import { Component } from '@angular/core';
import { Router } from '@angular/router';
export class RootComponent {
router: string;
constructor(
private _router: Router
) {
this.router = _router.url;
}
}
EDIT
I have tried to do this..
<home-header *ngIf="router.indexOf('app') > -1"></home-header>
and that did not work
I have also tried to do this..
export class RootComponent {
router: string;
constructor(
private _router: Router
) {
this._router.events.subscribe(() => this.router = this._router.url );
}
}