"Fossies" - the Fresh Open Source Software Archive

Member "angular-8.2.14/aio/content/examples/router/src/app/admin/admin-routing.module.2.ts" (13 Nov 2019, 1220 Bytes) of package /linux/www/angular-8.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // #docplaster
    2 // #docregion
    3 import { NgModule }              from '@angular/core';
    4 import { RouterModule, Routes }  from '@angular/router';
    5 
    6 import { AdminComponent }           from './admin/admin.component';
    7 import { AdminDashboardComponent }  from './admin-dashboard/admin-dashboard.component';
    8 import { ManageCrisesComponent }    from './manage-crises/manage-crises.component';
    9 import { ManageHeroesComponent }    from './manage-heroes/manage-heroes.component';
   10 
   11 // #docregion admin-route
   12 import { AuthGuard }                from '../auth/auth.guard';
   13 
   14 const adminRoutes: Routes = [
   15   {
   16     path: 'admin',
   17     component: AdminComponent,
   18     canActivate: [AuthGuard],
   19     children: [
   20       {
   21         path: '',
   22         children: [
   23           { path: 'crises', component: ManageCrisesComponent },
   24           { path: 'heroes', component: ManageHeroesComponent },
   25           { path: '', component: AdminDashboardComponent }
   26         ],
   27         // #enddocregion admin-route
   28         canActivateChild: [AuthGuard]
   29         // #docregion admin-route
   30       }
   31     ]
   32   }
   33 ];
   34 
   35 @NgModule({
   36   imports: [
   37     RouterModule.forChild(adminRoutes)
   38   ],
   39   exports: [
   40     RouterModule
   41   ]
   42 })
   43 export class AdminRoutingModule {}
   44 // #enddocregion