Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 render page without router-outlet

Tags:

angular

I have HTML template with slide menu and top nav menu and block for render main path page. like this:

...
<div class="content-wrapper">
    <router-outlet></router-outlet>
</div>
...

But after it, my login page render in this content-wrapper block. How to write some code for render LoginPage without route-outline component? (for not render top nav and slide menus)

like image 816
Taras Kovalenko Avatar asked Feb 07 '23 08:02

Taras Kovalenko


1 Answers

Keep the router-outlet, but use the router guards to prevent the route from being rendered unless the user logged in. I blogged about it here:

https://yakovfain.com/2016/07/20/angular-2-guarding-routes/

like image 158
Yakov Fain Avatar answered Feb 13 '23 05:02

Yakov Fain