A template for each component in Angular

0

I am setting up a web application and I have the following structure. I have an index.html file with the following code:

...
<body>
    <app-root></app-root>
</body>
...

in the app.component.html file I have html code where I have a repeating structure, that is, menus, footer ... and in that same document I have the label where the components load me.

My problem now is that I have a Login component where I do not want to inherit the rest of the HTML code, but I want it to be a page without inheriting anything, since it is the logic and I do not want to load the menus of the rest of component that form the application.

Any solution?

    
asked by Ramón Devesa 31.12.2018 в 17:25
source

1 answer

0

Use the ngIf

class MyComponent {
     constructor(public router: Router) {

     }
 }


 // micomponente.component.html

 <div *ngIf="router.url !== '/route'">
     // menús
 </div>
 <div *ngIf="router.url === '/route'">
     // login
 </div>
    
answered by 02.01.2019 / 01:57
source