angular: New Router Error: Uncaught (in promise): Cannot find default outlet
I am getting the following error when nesting a few routes using the new router.
Error: Uncaught (in promise): Cannot find default outlet
The route tree is based on the following url: “/nav/contacts/list” and has 4 components: root, navbar, contacts, and list. The contacts component has an inline template (“<router-outlet></router-outlet>
”) that is not being found by the router, but I can see the router-outlet in the DOM.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 28 (8 by maintainers)
I could not reproduce the error in plunker and I found my issue. I was including ROUTER_PROVIDERS in the root component and the contacts component. Removing them from the contacts component fixed the issue.
in my case I was missing the ROUTER_DIRECTIVES on the component that was hosting the subcomponent:
@frederikaalund I would not expect this to work. If a component has routes, it needs a
<router-outlet>
. You can’t just remove it, and that’s whatngIf
does. ´[hidden]=“isConnectionOpen”` should work though.