Skip to content

docs: Router - tell us to remove pathMatch: 'full' from lazy-routing modules #23900

Closed

Description

@wardbell

I stumbled badly in child route configuration because the Router guide didn’t tell me to remove pathMatch: 'full' from lazy loaded routes!

See what I mean in “CrisisCenter” route configuration:

  1. https://angular.io/guide/router#candeactivate-handling-unsaved-changes

  2. Then search for pathMatch and you will end up here:

const crisisCenterRoutes: Routes = [
  {
    path: '',
    redirectTo: '/crisis-center',
    pathMatch: 'full'
  },
  {
    path: 'crisis-center',
    component: CrisisCenterComponent,
    children: [
      {
        path: '',
        component: CrisisListComponent,
        children: [
          // ... more
        ]
      }
    ]
  }
];

I followed that pattern in my app. But because my module lazy loads, only the empty child path matched. The :id route did not match and was reported as an error. The router event trace tells me it isn’t matching but not why.

Later in the Router Guide, we talk a bit about configuration but we don’t talk about pathMatch. It just silently disappears from the lazy load configuration.

We should call out how important it is to remove pathMatch from lazy-configured routes!

Activity

  1. added this to the needsTriage milestone on May 15, 2018
  2. modified the milestones: needsTriage, Backlog on May 15, 2018
  3. brandonroberts commented on Sep 26, 2018

    @brandonroberts
    Contributor

    Fixed via #20023

  4. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions