I have a main application router that handles most of my routes. I wanted 
to add a module for test reasons which would contain a route module of its 
own. I followed the practices found in the Angular2 documentation. However 
my child route for the module is ignored and is redirected to the page not 
found component. When I remove the following code from the main router { 
path: '**', component: PageNotFoundPage } it works. However now I cannot 
use this code to handle 404 redirects. Anyone seen this issue before?

{ path: '**', component: PageNotFoundPage }

*My Main Application Router:*

const routes: Routes = [
  {
    path: '',
    redirectTo: '/landing',
    pathMatch: 'full'
  },
  { path: 'landing', component: LandingPage },
  { path: 'email-login', component: EmailLoginPage },
  { path: 'linkedin-login', component: LinkedinLoginPage },
  {
    path: 'dashboard',
    component: DashboardComponent,
    canActivate: [AuthGuard],
    children: [
      { path: 'devices', component: DevicesPage },
      { path: 'device/:id', component: DeviceDetailsPage },

      { path: 'groups', component: GroupsPage },
      { path: 'group/:id', component: GroupDetailsPage },
      { path: 'group-score', component: GroupScorePage },
      { path: 'group-devices', component: GroupDevicesPage },
      { path: 'group-members', component: GroupMembersPage },
      { path: 'group-invite-member', component: GroupInviteMemberPage },

      { path: 'sites', component: SitesPage },
      { path: 'site/:id', component: SiteDetailsPage },
      { path: 'site-score', component: SiteScorePage },
      { path: 'site-devices', component: SiteDevicesPage },
      { path: 'site-tenants', component: SiteTenantsPage },
      { path: 'site-invite-tenant', component: SiteInviteTenantPage },

      { path: 'profile', component: ProfilePage },
      { path: 'cyber-score', component: CyberScorePage },
      { path: '', component: DevicesPage }
    ]
  },
  { path: '**', component: PageNotFoundPage },
];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})

export class RoutingModule {}


*My Module Child Router:*

const testingRoutes: Routes = [
  { path: 'test-route',  component: TestingComponent }
];

@NgModule({
  imports: [
    RouterModule.forChild(testingRoutes)
  ],
  exports: [
    RouterModule
  ]
})

export class TestingRoutingModule {}

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to