In my app.component.html I want to render certain div containers based on the current url. For example
1. If current URL is authenticate render the following
<div *ngIf="'authenticate' === this.currentUrl">
<router-outlet></router-outlet>
</div>
2. If current URL is not authenticate, render the following
<div *ngIf="'authenticate' !== this.currentUrl" id="wrapper">
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="row extranet-outlet-wrapper">
<router-outlet></router-outlet>
</div>
</div>
</div>
</div>
</div>
</div>
I am not using any child routes. It is because, I want a different layout only for authenticate component and the rest remains same.
This is working when it first loads, but when I click on any [routerLink]
the view does not gets updated. However if I reload the screen it works. The issue is with the conditional rendering of <router-outlet>
in app.component.html
, I checked this by removing the condition and it works just fine.
Can someone help me understand what is happening here and how to go about fixing this if possible without using child routes.