0

Given the following code:

const LOCALIZED_PATHS: Route[] = [
  {
    path: 'activities',
    canActivate: [CountryGuard],
    loadChildren: 'app/common/activities/index/global/activity-index.module#ActivityIndexModule'
  }
];

.
.
.

RouterModule.forRoot([
      ...LOCALIZED_PATHS,

      /** GLOBAL ROUTES */
      // New Module
      {
        path: 'activities/new',
        loadChildren: 'app/common/activities/new/activity-new.module#ActivityNewModule'
      }
      .
      .
      .

And the route /activities/new.

I expect the router to test the rules inside LOCALIZED_PATHS, and if it returns false, to test the next rule (path: /activities/new) and match.

What is currently happening - according to the flow of the program in the google dev console - is that it's first testing the rules given by the ActivityIndexModule and returning false, then testing the canActivate guard and also returning false, but finally not navigating to the ActivityNewModule.

What am I missing? Am I understanding correctly the flow in the console as it should be running given the program logic?

Thank you very much for your time.

1 Answers1

0

Solved. Once a matcher catches a route, routing is over. Guards are post-matching, so even if it returns false, the router won't continue to try to match with the next rule.