1

In my angular2 app I have different pages. Every page except login page should contain menu area. I tried to make like that first:

RootComponentTemplate:

    <menu></menu>
    <router-outlet></router-outlet>

But I did not find the way to hide menu tag if the user is in login page.

I think that another way is to add menu tag to template of every component, but it seems a little bit weired.

Example:

ExamplePage

<menu></menu>
<content></content>

Example Page1

<menu></menu>
<content1></content1>

What is the right way to add common component to every page? Or is there a good way to say the root component to hide menu in login page?

I also found this question/solution , is it the right way?

Good template strategy for authentication in Angular 2

Community
  • 1
  • 1
norweny
  • 313
  • 1
  • 3
  • 15
  • I think that if the user is in login page he is not authenticated, so you can check if the user is authenticated or not to hide the menu using *ngIf directive, like in the example you referenced – Kayo Lima Jun 28 '16 at 18:09

0 Answers0