Angular auxiliary routes with named router-outlets: ERROR Error: Uncaught (in promise): Error: Cannot match...











up vote
0
down vote

favorite












I am having a hard time getting auxiliary routes to work, even in a minimalistic scenario.
I'm pretty sure, I stuck to the angular documentation on routes and multiple outlets down to a T, so I really have no idea what I am missing.



app.routing.ts:



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


app.component.html:



<h2>I am the app component</h2>
<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>


Before using routerLink, I wanted to get it to work by entering a URL right into the browser. Is it possible, that I missed something crucial regarding navigating to aux routes by direct URL?
Here's what happens when directly hacking in URLS:





  • http://localhost:4200/ works; app.component.html is displayed


  • http://localhost:4200/somethingfallback123 works; due to the fallback-route, app.component.html is displayed


  • http://localhost:4200/(simpleOutlet:simple) does not work
    neither does http://localhost:4200(simpleOutlet:simple), http://localhost:4200/(simpleOutlet:/simple), http://localhost:4200/(simpleOutlet:simple/) etc.. (you can see, I am desperate)




Stackblitz link





ERROR LOGS:



Mozilla Firefox:



ERROR Error: "[object Object]"
resolvePromise http://localhost:4200/polyfills.js:7882:31
resolvePromise http://localhost:4200/polyfills.js:7839:17
scheduleResolveOrReject http://localhost:4200/polyfills.js:7941:17
invokeTask http://localhost:4200/polyfills.js:7489:17
onInvokeTask http://localhost:4200/vendor.js:70021:24
invokeTask http://localhost:4200/polyfills.js:7488:17
runTask http://localhost:4200/polyfills.js:7256:28
drainMicroTaskQueue http://localhost:4200/polyfills.js:7663:25


It seems to be a know issue that Firefox does not throw correct error messages.



Google Chrome:



ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL             Segment: 'simple'
Error: Cannot match any routes. URL Segment: 'simple'




Environment (angular version: ng v)



Angular CLI: 7.0.4
Node: 9.7.1
OS: linux x64
Angular: 7.0.2









share|improve this question
























  • it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
    – לבני מלכה
    Nov 12 at 9:11










  • thank you for your response! I updated the original post.
    – RichardM90ger
    Nov 12 at 9:43















up vote
0
down vote

favorite












I am having a hard time getting auxiliary routes to work, even in a minimalistic scenario.
I'm pretty sure, I stuck to the angular documentation on routes and multiple outlets down to a T, so I really have no idea what I am missing.



app.routing.ts:



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


app.component.html:



<h2>I am the app component</h2>
<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>


Before using routerLink, I wanted to get it to work by entering a URL right into the browser. Is it possible, that I missed something crucial regarding navigating to aux routes by direct URL?
Here's what happens when directly hacking in URLS:





  • http://localhost:4200/ works; app.component.html is displayed


  • http://localhost:4200/somethingfallback123 works; due to the fallback-route, app.component.html is displayed


  • http://localhost:4200/(simpleOutlet:simple) does not work
    neither does http://localhost:4200(simpleOutlet:simple), http://localhost:4200/(simpleOutlet:/simple), http://localhost:4200/(simpleOutlet:simple/) etc.. (you can see, I am desperate)




Stackblitz link





ERROR LOGS:



Mozilla Firefox:



ERROR Error: "[object Object]"
resolvePromise http://localhost:4200/polyfills.js:7882:31
resolvePromise http://localhost:4200/polyfills.js:7839:17
scheduleResolveOrReject http://localhost:4200/polyfills.js:7941:17
invokeTask http://localhost:4200/polyfills.js:7489:17
onInvokeTask http://localhost:4200/vendor.js:70021:24
invokeTask http://localhost:4200/polyfills.js:7488:17
runTask http://localhost:4200/polyfills.js:7256:28
drainMicroTaskQueue http://localhost:4200/polyfills.js:7663:25


It seems to be a know issue that Firefox does not throw correct error messages.



Google Chrome:



ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL             Segment: 'simple'
Error: Cannot match any routes. URL Segment: 'simple'




Environment (angular version: ng v)



Angular CLI: 7.0.4
Node: 9.7.1
OS: linux x64
Angular: 7.0.2









share|improve this question
























  • it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
    – לבני מלכה
    Nov 12 at 9:11










  • thank you for your response! I updated the original post.
    – RichardM90ger
    Nov 12 at 9:43













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am having a hard time getting auxiliary routes to work, even in a minimalistic scenario.
I'm pretty sure, I stuck to the angular documentation on routes and multiple outlets down to a T, so I really have no idea what I am missing.



app.routing.ts:



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


app.component.html:



<h2>I am the app component</h2>
<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>


Before using routerLink, I wanted to get it to work by entering a URL right into the browser. Is it possible, that I missed something crucial regarding navigating to aux routes by direct URL?
Here's what happens when directly hacking in URLS:





  • http://localhost:4200/ works; app.component.html is displayed


  • http://localhost:4200/somethingfallback123 works; due to the fallback-route, app.component.html is displayed


  • http://localhost:4200/(simpleOutlet:simple) does not work
    neither does http://localhost:4200(simpleOutlet:simple), http://localhost:4200/(simpleOutlet:/simple), http://localhost:4200/(simpleOutlet:simple/) etc.. (you can see, I am desperate)




Stackblitz link





ERROR LOGS:



Mozilla Firefox:



ERROR Error: "[object Object]"
resolvePromise http://localhost:4200/polyfills.js:7882:31
resolvePromise http://localhost:4200/polyfills.js:7839:17
scheduleResolveOrReject http://localhost:4200/polyfills.js:7941:17
invokeTask http://localhost:4200/polyfills.js:7489:17
onInvokeTask http://localhost:4200/vendor.js:70021:24
invokeTask http://localhost:4200/polyfills.js:7488:17
runTask http://localhost:4200/polyfills.js:7256:28
drainMicroTaskQueue http://localhost:4200/polyfills.js:7663:25


It seems to be a know issue that Firefox does not throw correct error messages.



Google Chrome:



ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL             Segment: 'simple'
Error: Cannot match any routes. URL Segment: 'simple'




Environment (angular version: ng v)



Angular CLI: 7.0.4
Node: 9.7.1
OS: linux x64
Angular: 7.0.2









share|improve this question















I am having a hard time getting auxiliary routes to work, even in a minimalistic scenario.
I'm pretty sure, I stuck to the angular documentation on routes and multiple outlets down to a T, so I really have no idea what I am missing.



app.routing.ts:



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


app.component.html:



<h2>I am the app component</h2>
<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>


Before using routerLink, I wanted to get it to work by entering a URL right into the browser. Is it possible, that I missed something crucial regarding navigating to aux routes by direct URL?
Here's what happens when directly hacking in URLS:





  • http://localhost:4200/ works; app.component.html is displayed


  • http://localhost:4200/somethingfallback123 works; due to the fallback-route, app.component.html is displayed


  • http://localhost:4200/(simpleOutlet:simple) does not work
    neither does http://localhost:4200(simpleOutlet:simple), http://localhost:4200/(simpleOutlet:/simple), http://localhost:4200/(simpleOutlet:simple/) etc.. (you can see, I am desperate)




Stackblitz link





ERROR LOGS:



Mozilla Firefox:



ERROR Error: "[object Object]"
resolvePromise http://localhost:4200/polyfills.js:7882:31
resolvePromise http://localhost:4200/polyfills.js:7839:17
scheduleResolveOrReject http://localhost:4200/polyfills.js:7941:17
invokeTask http://localhost:4200/polyfills.js:7489:17
onInvokeTask http://localhost:4200/vendor.js:70021:24
invokeTask http://localhost:4200/polyfills.js:7488:17
runTask http://localhost:4200/polyfills.js:7256:28
drainMicroTaskQueue http://localhost:4200/polyfills.js:7663:25


It seems to be a know issue that Firefox does not throw correct error messages.



Google Chrome:



ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL             Segment: 'simple'
Error: Cannot match any routes. URL Segment: 'simple'




Environment (angular version: ng v)



Angular CLI: 7.0.4
Node: 9.7.1
OS: linux x64
Angular: 7.0.2






angular routing angular7 router-outlet






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 8 at 3:30









BSMP

2,53952334




2,53952334










asked Nov 12 at 8:45









RichardM90ger

32




32












  • it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
    – לבני מלכה
    Nov 12 at 9:11










  • thank you for your response! I updated the original post.
    – RichardM90ger
    Nov 12 at 9:43


















  • it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
    – לבני מלכה
    Nov 12 at 9:11










  • thank you for your response! I updated the original post.
    – RichardM90ger
    Nov 12 at 9:43
















it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
– לבני מלכה
Nov 12 at 9:11




it will be easy to help you if you put your relevant code here:stackblitz.com/edit/angular-6s9716 (fork and post the link)
– לבני מלכה
Nov 12 at 9:11












thank you for your response! I updated the original post.
– RichardM90ger
Nov 12 at 9:43




thank you for your response! I updated the original post.
– RichardM90ger
Nov 12 at 9:43












2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










here the code to solve this issue StackBlitz



in app.routing.ts



instead



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


do



const appRoutes: Routes = [
{
path: 'main',
component: AppComponent,
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
}
]
}
];


and instead



exports: [RouterModule, appRoutes]


do



exports: [RouterModule]



in app.component.html



instead



<h1>
app component
</h1>

<router-outlet></router-outlet>


do



<h1>
app component
</h1>

<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>



in app.module.ts



remove import { Routes, RouterModule } from '@angular/router'; you not need it here you already made a separated Routing file



add



import { AppRoutingModule } from './app.routing';
import { SimpleComponent } from './simple/simple.component';


instead



@NgModule({
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot()
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})


do



@NgModule({
declarations: [ AppComponent, HelloComponent, SimpleComponent ],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
bootstrap: [ AppComponent ]
})


do that as following declarations then imports the order is important as long you made a separated routing file



for more details and reference take a look on the link mentioned above.






share|improve this answer





















  • Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
    – RichardM90ger
    Nov 12 at 14:26




















up vote
0
down vote













Change RouterModule to RouterModule.forRoot() in app.module file:



@NgModule({
imports: [ BrowserModule,
FormsModule,
RouterModule.forRoot() //this line
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})





share|improve this answer





















  • Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
    – RichardM90ger
    Nov 12 at 10:19












  • remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
    – לבני מלכה
    Nov 12 at 11:57











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258519%2fangular-auxiliary-routes-with-named-router-outlets-error-error-uncaught-in-pr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










here the code to solve this issue StackBlitz



in app.routing.ts



instead



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


do



const appRoutes: Routes = [
{
path: 'main',
component: AppComponent,
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
}
]
}
];


and instead



exports: [RouterModule, appRoutes]


do



exports: [RouterModule]



in app.component.html



instead



<h1>
app component
</h1>

<router-outlet></router-outlet>


do



<h1>
app component
</h1>

<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>



in app.module.ts



remove import { Routes, RouterModule } from '@angular/router'; you not need it here you already made a separated Routing file



add



import { AppRoutingModule } from './app.routing';
import { SimpleComponent } from './simple/simple.component';


instead



@NgModule({
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot()
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})


do



@NgModule({
declarations: [ AppComponent, HelloComponent, SimpleComponent ],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
bootstrap: [ AppComponent ]
})


do that as following declarations then imports the order is important as long you made a separated routing file



for more details and reference take a look on the link mentioned above.






share|improve this answer





















  • Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
    – RichardM90ger
    Nov 12 at 14:26

















up vote
0
down vote



accepted










here the code to solve this issue StackBlitz



in app.routing.ts



instead



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


do



const appRoutes: Routes = [
{
path: 'main',
component: AppComponent,
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
}
]
}
];


and instead



exports: [RouterModule, appRoutes]


do



exports: [RouterModule]



in app.component.html



instead



<h1>
app component
</h1>

<router-outlet></router-outlet>


do



<h1>
app component
</h1>

<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>



in app.module.ts



remove import { Routes, RouterModule } from '@angular/router'; you not need it here you already made a separated Routing file



add



import { AppRoutingModule } from './app.routing';
import { SimpleComponent } from './simple/simple.component';


instead



@NgModule({
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot()
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})


do



@NgModule({
declarations: [ AppComponent, HelloComponent, SimpleComponent ],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
bootstrap: [ AppComponent ]
})


do that as following declarations then imports the order is important as long you made a separated routing file



for more details and reference take a look on the link mentioned above.






share|improve this answer





















  • Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
    – RichardM90ger
    Nov 12 at 14:26















up vote
0
down vote



accepted







up vote
0
down vote



accepted






here the code to solve this issue StackBlitz



in app.routing.ts



instead



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


do



const appRoutes: Routes = [
{
path: 'main',
component: AppComponent,
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
}
]
}
];


and instead



exports: [RouterModule, appRoutes]


do



exports: [RouterModule]



in app.component.html



instead



<h1>
app component
</h1>

<router-outlet></router-outlet>


do



<h1>
app component
</h1>

<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>



in app.module.ts



remove import { Routes, RouterModule } from '@angular/router'; you not need it here you already made a separated Routing file



add



import { AppRoutingModule } from './app.routing';
import { SimpleComponent } from './simple/simple.component';


instead



@NgModule({
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot()
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})


do



@NgModule({
declarations: [ AppComponent, HelloComponent, SimpleComponent ],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
bootstrap: [ AppComponent ]
})


do that as following declarations then imports the order is important as long you made a separated routing file



for more details and reference take a look on the link mentioned above.






share|improve this answer












here the code to solve this issue StackBlitz



in app.routing.ts



instead



const appRoutes: Routes = [
{
path: '',
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent
},

// default route, *WORKS*
{
path: '',
component: AppComponent
},
// fallback route, *WORKS*
{
path: '**',
component: AppComponent,
redirectTo: ''
}
]
}
];


do



const appRoutes: Routes = [
{
path: 'main',
component: AppComponent,
children: [
// aux route with named outlet, **DOES NTO WORK :(**
{
path: 'simple',
component: SimpleComponent,
outlet: 'simpleOutlet'
}
]
}
];


and instead



exports: [RouterModule, appRoutes]


do



exports: [RouterModule]



in app.component.html



instead



<h1>
app component
</h1>

<router-outlet></router-outlet>


do



<h1>
app component
</h1>

<router-outlet></router-outlet>
<router-outlet name="simpleOutlet"></router-outlet>



in app.module.ts



remove import { Routes, RouterModule } from '@angular/router'; you not need it here you already made a separated Routing file



add



import { AppRoutingModule } from './app.routing';
import { SimpleComponent } from './simple/simple.component';


instead



@NgModule({
imports: [
BrowserModule,
FormsModule,
RouterModule.forRoot()
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})


do



@NgModule({
declarations: [ AppComponent, HelloComponent, SimpleComponent ],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule
],
bootstrap: [ AppComponent ]
})


do that as following declarations then imports the order is important as long you made a separated routing file



for more details and reference take a look on the link mentioned above.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 11:14









Amir Fawzy

2188




2188












  • Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
    – RichardM90ger
    Nov 12 at 14:26




















  • Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
    – RichardM90ger
    Nov 12 at 14:26


















Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
– RichardM90ger
Nov 12 at 14:26






Thank you so much! For this minimalistic example, it finally works =) I'm still having trouble with my actual project where I want to use this concept. Because I use seperate routing config files and resolver services there but I'm surre I will figure it out. Unfortunately, I cannot give you positive ratings yet. But imagine, I gave you 200, which is about how many hours I've been stuck on this now.
– RichardM90ger
Nov 12 at 14:26














up vote
0
down vote













Change RouterModule to RouterModule.forRoot() in app.module file:



@NgModule({
imports: [ BrowserModule,
FormsModule,
RouterModule.forRoot() //this line
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})





share|improve this answer





















  • Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
    – RichardM90ger
    Nov 12 at 10:19












  • remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
    – לבני מלכה
    Nov 12 at 11:57















up vote
0
down vote













Change RouterModule to RouterModule.forRoot() in app.module file:



@NgModule({
imports: [ BrowserModule,
FormsModule,
RouterModule.forRoot() //this line
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})





share|improve this answer





















  • Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
    – RichardM90ger
    Nov 12 at 10:19












  • remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
    – לבני מלכה
    Nov 12 at 11:57













up vote
0
down vote










up vote
0
down vote









Change RouterModule to RouterModule.forRoot() in app.module file:



@NgModule({
imports: [ BrowserModule,
FormsModule,
RouterModule.forRoot() //this line
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})





share|improve this answer












Change RouterModule to RouterModule.forRoot() in app.module file:



@NgModule({
imports: [ BrowserModule,
FormsModule,
RouterModule.forRoot() //this line
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 9:48









לבני מלכה

8,6911524




8,6911524












  • Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
    – RichardM90ger
    Nov 12 at 10:19












  • remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
    – לבני מלכה
    Nov 12 at 11:57


















  • Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
    – RichardM90ger
    Nov 12 at 10:19












  • remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
    – לבני מלכה
    Nov 12 at 11:57
















Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
– RichardM90ger
Nov 12 at 10:19






Thank you! But I don't undestand what exactly you advise me to do. Isn't there an argument missing in the forRoot() call as you wrote? For example forRoot([appRoutes]) (with appRoutes being imported from app.routing.ts ?
– RichardM90ger
Nov 12 at 10:19














remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
– לבני מלכה
Nov 12 at 11:57




remove the forRoot([appRoutes]) from route as in this example:angular.io/tutorial/toh-pt5
– לבני מלכה
Nov 12 at 11:57


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258519%2fangular-auxiliary-routes-with-named-router-outlets-error-error-uncaught-in-pr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python