import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { HomeComponent } from './home/home.component' ; import { CreateComponent } from './create/create.component' ; import { WalletComponent } from './wallet/wallet.component' ; import { WalletbaseComponent } from './wallet/walletbase/walletbase.component' ; import { WalletsendComponent } from './wallet/walletsend/walletsend.component' ; import { WallethistoryComponent } from './wallet/wallethistory/wallethistory.component' ; import { ContractComponent } from './wallet/contract/contract.component' ; import { ErrorComponent } from './error/error.component' ; import { MaintenanceComponent } from './error/maintenance.component' ; import { AuthGuardService } from './auth-guard.service' ; const routes = [ { path : '' , redirectTo : '/home' , pathMatch : 'full' } , { path : 'home' , component : HomeComponent } , { path : 'create' , component : CreateComponent } , { path : 'wallet' , component : WalletComponent , canActivate : [ AuthGuardService ] , children : [ { path : '' , redirectTo : 'base' , pathMatch : 'full' } , { path : 'base' , component : WalletbaseComponent } , { path : 'send' , component : WalletsendComponent } ] } , { path : 'maintenance' , component : MaintenanceComponent } , { path : '404' , component : ErrorComponent } , { path : '**' , redirectTo : '/404' } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }