pcb demo code.
[ealt-edge.git] / example-apps / PDD / frontend-src / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core';
2 import { Routes, RouterModule, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
3 import { HomeComponent } from './home/home.component';
4
5 import { PcbComponent } from './pcb/pcb.component';
6 import { PcbimagesComponent } from './pcbimages/pcbimages.component';
7 import { PcboutputimagesComponent } from './pcboutputimages/pcboutputimages.component';
8
9
10
11
12 const routes: Routes = [
13
14   {
15     path: '',
16     component: HomeComponent
17     // canActivate: [AuthGuard]
18   },
19   {
20     path: 'akrainowiki',
21     component: HomeComponent,
22     resolve: {
23       url: 'externalUrlRedirectResolver'
24     },
25     data: {
26       externalUrl: 'https://wiki.akraino.org/display/AK/ELIOT%3A+Edge+Lightweight+and+IoT+Blueprint+Family?src=contextnavpagetreemode'
27     }
28   },
29   {
30     path: 'pcb',
31     component: PcbComponent,
32   },
33   {
34     path: 'displayimage',
35     component: PcbimagesComponent,
36   },
37   {
38     path: 'results',
39     component: PcboutputimagesComponent,
40   },
41   {
42     path: '**',
43     redirectTo: ''
44   }
45 ];
46
47 @NgModule({
48   imports: [RouterModule.forRoot(routes, {
49     scrollPositionRestoration: 'enabled'
50   })],
51   exports: [RouterModule],
52   providers: [
53     {
54         provide: 'externalUrlRedirectResolver',
55         useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
56         {
57             // window.location.href = (route.data as any).externalUrl;
58             window.open((route.data as any).externalUrl);
59             debugger;
60             console.log(route.url);
61             route.url[0].path="";
62
63         }
64     }
65 ]
66 })
67 export class AppRoutingModule { }