0

I want to use <router-outlet> inside RadSideDrawer drawerMain

but i get the error Cannot find primary outlet to load Component

The component has

 directives: [NS_ROUTER_DIRECTIVES, ROUTER_DIRECTIVES]

The HTML has <router-outlet> Tag so it should work

Code: https://github.com/telerik/nativescript-ui-samples-angular/issues/13

Notice: when i remove RadSideDrawer codes from HTML file works normally. So i think the problem is due to with RadSideDrawer

Any solutions? Thanks

Vladimir Amiorkov
  • 2,652
  • 3
  • 17
  • 35
Ahmed Elgendy
  • 1,670
  • 2
  • 12
  • 17

1 Answers1

1

The <router-outlet> can not be inside a <template> element. It must be added directly to the view.

I assume the template is rendered somehow but it is not obvious from the code you provided where or how that is happening.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Yeah but how can i make router-outlet works without this template tag: ? – Ahmed Elgendy Jul 24 '16 at 17:11
  • I don't know NS and I don't know `RadSideDrawer` but if you have a route for the component that contains this view, then this component needs to contain a ``. To me it seems the `` isn't rendered anywhere. If you wrap the `` with for example `
    xxx
    `, is `xxx` shown on the screen?
    – Günter Zöchbauer Jul 24 '16 at 17:16
  • Yes every xxx is working normally, Consoling the button shows that it works normally but nothing is being rendered to the router-outlet – Ahmed Elgendy Jul 24 '16 at 17:22
  • Sorry, then I don't know. If you can reproduce in a Plunker it would be worth a bug report in the Angular GitHub repo. – Günter Zöchbauer Jul 24 '16 at 17:25