0

When I load a route to the primary router-outlet, Angular creates a sibling element to show the content. For example, my route "events" is loaded like this in the DOM:

enter image description here

Is this correct? Or should the <app-events> element be inside <router-outlet>?

The website does look like it should in the browser.

BigJ
  • 1,990
  • 2
  • 29
  • 47

1 Answers1

0

Yes, this is correct. Angular generate the route elements after the router-outlet element.

From Angular docs about the RouterOutlet:

Acts as a placeholder that Angular dynamically fills based on the current router state.

Also, You can use multiple routes as answered here.

Asaf
  • 1,446
  • 9
  • 17
  • Actually, that quote seems to suggest that the content should be inside the element. – BigJ Sep 16 '20 at 20:42
  • I don't see much difference about the location of the dynamic content. For example, if you got 2 routes, so the content would be - option 1 as sibling one content at the time, or option 2 - inside each router element. I think that for clarity option 2 is better... – Asaf Sep 16 '20 at 20:56