Skip to content

Defining routes as both nested and top levelΒ #74

@danielcornock

Description

@danielcornock

In my application I have an entity 'stories', that I want to be able to reach from the top level of routes (e.g. api/v1/stories) but also to access it nested so that it can have parameters for another entity, e.g. api/v1/boards/:boardId/stories.

Is this possible with the current build? I've tried out different ways of organising them but it seems that multiple declarations of a module will overwrite any previous ones.

For example one setup that I tried was:

const routes: Routes = [
  {
    path: '/stories',
    module: StoryModule
  },
  {
    path: '/boards',
    module: BoardModule,
    children: [
      {
        path: '/:boardId/stories',
        module: StoryModule
      }
    ]
  }
];

In this case the boards route and nested stories route works, but the top level stories route does not. If i place the top level stories route after the nested route, that one works and the nested one doesn't.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions