Hy,
I have currently a problem with routing in my child routes . My correct project is built like this:
app.ts
configureRouter(config: RouterConfiguration, router: Router) {
config.map([
{
route: ["candidates"],
name: "candidates",
moduleId: PLATFORM.moduleName("pages/candidates/candidates-routes"),
nav: true,
activationStrategy: activationStrategy.replace,
},
]);
this.router = router;
}
In my candidates routes I have the following
candidates-routes.ts
public configureRouter(config: RouterConfiguration, router: Router) {
config.map([
{
name: "candidates",
route: "",
nav: false,
title: "title",
viewPorts: {
mainContent: { moduleId: PLATFORM.moduleName("./candidates") },
},
},
{
name: "candidate-detail",
route: [":id", ":id/:tab?"],
moduleId: PLATFORM.moduleName("pages/candidates/candidate-detail/candidate-detail"),
nav: false,
title: "title",
viewPorts: {
mainContent: { moduleId: PLATFORM.moduleName("./candidate-detail/candidate-detail") },
},
},
]);
this.router = router;
}
Now when I try to navigate to the named route candidate-detail
I get problems. For example being inside the candidate-detail and calling this.router.navigateToRoute
results in this url: localhost:8080/[id]
but should actually be localhost:8080/candidates/[id]
Also when I call this.router.navigateToRoute("candidate-detail", { id })
from pages/search
for example I get : A route with name 'candidate-detail' could not be found.
What am I doing wrong? Is there anything else which I should add here?
Thanks in advance for any help