Disclaimer: This is a duplicate of Changing router-outlet with *ngIf in app.component.html in angular2 which has an accepted answer which does not solve my situation though.
So here is my problem: I would like to have the same "router-outlet" twice in my main-component. As it seems only the second "router-outlet" wins and displays the content correctly. The propose solution of wrapping the router-outlet in a ng-template does not work for me.
This is my situation in code:
<div class="mobile-only">
<div>some special content for mobile version</div>
<router-outlet></router-outlet>
</div>
<div class="desktop-only">
<div>some special content for desktop version</div>
<router-outlet></router-outlet>
</div>
Only the second router-outlet gets updated when the user navigates the page. The first router-outlet is abandonned by angular.
Question: How can I reuse the router-outlet?
Edit: I have tried to wrap the router-outlet in a ng-template, it did not work though: https://stackblitz.com/edit/router-outlet-in-template-not-working-example-cpyjbq
And here is a working version: https://stackblitz.com/edit/router-outlet-in-template-working-example
I can actually reuse the router-outlet --- but only at the cost of reassigning the template-variable in a setTimeout. As a nasty side-effect the components are reinstantiated.