angular2-authentication-sample
angular2-authentication-sample copied to clipboard
Router: ORIGINAL EXCEPTION: Primary outlet is already registered.
Why in 2.0.0-beta.17 I can not use anymore custom layouts for router-outlet? I get an error if I want to change the layout in application. For example:
<div class="guest-layout" *ngIf="auth.isGuest">
<router-outlet></router-outlet>
</div>
<div class="member-layout" *ngIf="auth.isMember">
<router-outlet></router-outlet>
</div>
When they should change, I get:
angular2.dev.js?v=1.0.0:25644 Error: Primary outlet is already registered.
at new BaseException (angular2.dev.js?v=1.0.0:5496)
at e.t.registerPrimaryOutlet (router.min.js?v=1.0.0:3)
at RouterDirective.t (router.min.js?v=1.0.0:2)
at new RouterDirective (router.js:26)
Maybe there are another ways of doing this?
Same issue here, solved by the code below
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
import {RouterOutlet} from '@angular/router-deprecated';
....
// when using ROUTER_DIRECTIVES apply the filter
ROUTER_DIRECTIVES.filter(direc => direc != RouterOutlet)