Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router: ORIGINAL EXCEPTION: Primary outlet is already registered. #63

Open
greg-md opened this issue May 3, 2016 · 1 comment
Open

Comments

@greg-md
Copy link

greg-md commented May 3, 2016

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?

@marcusdb
Copy link

marcusdb commented Jun 5, 2016

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants