Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular rc1: EXCEPTION: Error: Uncaught (in promise): Cannot find default outlet

I really should paste source-code here, but I do not know which part of those 300 lines in my component I should show you.

Maybe the error-message "EXCEPTION: Error: Uncaught (in promise): Cannot find default outlet" has a general solution to it? Am I missing some parameter or tag?

like image 276
Tobias Gassmann Avatar asked Dec 05 '22 17:12

Tobias Gassmann


2 Answers

  • add the <router-outlet> where the router expects it ;-)
  • ensure you don't provide ROUTER_PROVIDERS more than once in your application (either only at the root component or only in bootstrap())
  • don't add *ngIf* to the <router-outlet> or to a parent of <router-outlet>

See also https://github.com/angular/angular/issues/8539

like image 187
Günter Zöchbauer Avatar answered Dec 09 '22 13:12

Günter Zöchbauer


I found it:

The component hosting the subcomponent needs to declare

directives: [ROUTER_DIRECTIVES],

otherwise the is not recognized, as it seems.

like image 20
Tobias Gassmann Avatar answered Dec 09 '22 13:12

Tobias Gassmann