0

I have my angular component:

@Component({
  selector: 'test-app',
  template: `
        <div *ngIf="isEmptyLayout">
            <router-outlet></router-outlet>
        </div>

        <div *ngIf="!isEmptyLayout">
            <h1>Not empty template</h1>
            <router-outlet></router-outlet>
        </div>
  `
})
export class AppComponent { ...

What I want to do is create separated layout for landing page and admin area. However, this renders an error. What are your suggestions to render router-outlet few times depending on current url?

Haris Bašić
  • 1,383
  • 2
  • 12
  • 21

2 Answers2

0

You can try this Multiple layout in angular 2.

Hope it helps. Been using it for a while now and it scales very well no matter the number of layout your would want to use in your app

Community
  • 1
  • 1
oseintow
  • 7,221
  • 3
  • 26
  • 31
0

Why do you want to use multiple router outlets? You could structure your template like this:

<div>
    <h1 *ngIf="!isEmptyLayout">Not empty template</h1>
    <router-outlet></router-outlet>
</div>
Tudor Ciotlos
  • 1,805
  • 4
  • 29
  • 47