How to remove screen header on some routes

Asked

Viewed 56 times

0

Good morning guys, in my angular project 4 I completed the Adm screen and I wish the header did not appear in it, I know I could do this with ngIf but I’m lost >_>, Can someone give a light? The app module.html looks like this

<app-navbar></app-navbar>
<div style="padding-top:100px" class="container">
  <flash-messages></flash-messages>
  <router-outlet></router-outlet>
</div>

1 answer

0

Would you like to remove the <app-navbar> or the header comes from this <router-outlet>?

  • would like to remove the <app-navbar>

  • Really the best option in this case would be a *ngIf. If you just want to get rid of it without dynamism, you can put <app-navbar *ngIf="true"></app-navbar>. Now if you want this behavior to occur whenever you do an action you will have to in some method change its value. For example, supposing that (click)="mostrarCabecalho()", within this method you must set another variable, for example isCabecalho that will be like false and will pass to true. That variable should be in your header, so: <app-navbar *ngIf="isCabecalho"></app-navbar>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.