New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested parameterized routes #17
Comments
The RouterModule is just adding a prefixes to the all Controllers registered at that Module, so for Example {
path: 'ninja', // the prefix slash is optional
module: NinjaModule
} and we registered ...
@Controller(':ninjaId')
export class NinjaController {
@Get()
findNinja(@Param('ninjaId') ninjaId) {
return { ninjaId };
}
} so if we hit back to your question, we need to achieve this in my opinion, each controller - {
path: 'ninja`
module: NinjaModule,
children: [{ path: 'cats', module: CatsModule }, ...]
} you will need to make it like this {
path: 'ninja/:ninjaId`
module: NinjaModule,
children: [{ path: 'cats', module: CatsModule }, ...]
} that way, the Controllers registered at and now both give it a shot and let me know if there is any problem 😀 |
Great! |
So, in the previous example, you moved GET /ninjas -> [{ninjaId: ...}, {ninjaId: ...}] Can this be achieved with this router module, without having to hack the route for |
Hi there!!
Based on your example:
const routes: Routes = [
{
path: '/ninja',
module: NinjaModule,
children: [
{
path: '/cats',
module: CatsModule,
},
{
path: '/dogs',
module: DogsModule,
},
],
},
];
Is it possible a request like this: /ninja/01008/cats or this /ninja/n01/dogs ?
Thanks for your work!
The text was updated successfully, but these errors were encountered: