1
1
import { NgModule } from '@angular/core' ;
2
- import { RouterModule , Routes } from '@angular/router' ;
2
+ import { mapToCanDeactivate , RouterModule , Routes } from '@angular/router' ;
3
3
4
4
import { DashboardComponent } from './logbook/dashboard/dashboard.component' ;
5
5
import { TodosComponent } from './logbook/widgets/todos/todos.component' ;
@@ -25,13 +25,13 @@ const routes: Routes = [
25
25
{ path : 'download/:fileId' , component : DownloadComponent } ,
26
26
{ path : 'logbooks/:logbookId' , component : LogbookComponent ,
27
27
children : [
28
- { path : 'dashboard' , component : DashboardComponent , canDeactivate : [ NavigationGuardService ] } ,
28
+ { path : 'dashboard' , component : DashboardComponent , canDeactivate : mapToCanDeactivate ( [ NavigationGuardService ] ) } ,
29
29
{ path : 'todos' , component : TodosComponent } ,
30
30
{ path : 'logbook' , component : LogbookItemComponent } ,
31
31
{ path : 'snippetViewer' , component : SnippetViewerComponent } ,
32
32
{ path : 'chat' , component : ChatComponent } ,
33
33
{ path : 'graph' , component : ChartComponent } ,
34
- { path : 'dashboard-item' , component : DashboardItemComponent , canDeactivate : [ NavigationGuardService ] } ,
34
+ { path : 'dashboard-item' , component : DashboardItemComponent , canDeactivate : mapToCanDeactivate ( [ NavigationGuardService ] ) } ,
35
35
{ path : '**' , redirectTo : '/overview' , pathMatch : 'full' } ,
36
36
] } ,
37
37
{ path : 'viewSettings' , component : ViewSettingsComponent , outlet : 'settings' } ,
@@ -42,6 +42,7 @@ const routes: Routes = [
42
42
43
43
@NgModule ( {
44
44
imports : [ RouterModule . forRoot ( routes , { canceledNavigationResolution : 'computed' } ) ] ,
45
+ providers : [ NavigationGuardService ] ,
45
46
exports : [ RouterModule ]
46
47
} )
47
48
export class AppRoutingModule { }
0 commit comments