|
1 | | -import { NgModule } from '@angular/core'; |
2 | | -import { Routes, RouterModule } from '@angular/router'; |
3 | | -import { AuthComponent } from './auth/auth.component'; |
4 | | -import { PortfolioComponent } from './portfolio/portfolio.component'; |
5 | | -import { StocksComponent } from './stocks/stocks.component'; |
6 | | -import { SipComponent } from './sip/sip.component'; |
7 | | -import { AuthGuard } from './auth/auth.guard'; |
8 | | -import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; |
9 | | -import { PortfolioDetailComponent } from './portfolio/portfolio-detail/portfolio-detail.component'; |
10 | | -import { PortfolioResolverService } from './portfolio/portfolio-resolver.service'; |
11 | | -import { StockDetailComponent } from './stocks/stock-detail/stock-detail.component'; |
12 | | -import { StockResolverService } from './stocks/stock-resolver.service'; |
13 | | - |
14 | | -const routes: Routes = [ |
15 | | - { path: '', redirectTo: '/portfolio', pathMatch: 'full' }, |
16 | | - { path: 'auth', component: AuthComponent }, |
17 | | - { |
18 | | - path: 'portfolio', component: PortfolioComponent, resolve: { portfolioList: PortfolioResolverService }, canActivate: [AuthGuard], |
19 | | - children: [ |
20 | | - { |
21 | | - path: ':id', |
22 | | - component: PortfolioDetailComponent |
23 | | - } |
24 | | - ] |
25 | | - }, |
26 | | - { path: 'sip-calculator', component: SipComponent, canActivate: [AuthGuard] }, |
27 | | - { |
28 | | - path: 'stocks', component: StocksComponent, canActivate: [AuthGuard], resolve: { stockList: StockResolverService }, |
29 | | - children: [ |
30 | | - { |
31 | | - path: ':id', |
32 | | - component: StockDetailComponent |
33 | | - } |
34 | | - ] |
35 | | - }, |
36 | | - { path: 'not-found', component: PageNotFoundComponent }, |
37 | | - { path: '**', redirectTo: 'not-found' } |
38 | | -]; |
39 | | - |
40 | | -@NgModule({ |
41 | | - imports: [RouterModule.forRoot(routes, {})], |
42 | | - exports: [RouterModule] |
43 | | -}) |
44 | | -export class AppRoutingModule { } |
| 1 | +import { NgModule } from '@angular/core'; |
| 2 | +import { Routes, RouterModule } from '@angular/router'; |
| 3 | +import { AuthComponent } from './auth/auth.component'; |
| 4 | +import { PortfolioComponent } from './portfolio/portfolio.component'; |
| 5 | +import { StocksComponent } from './stocks/stocks.component'; |
| 6 | +import { SipComponent } from './sip/sip.component'; |
| 7 | +import { AuthGuard } from './auth/auth.guard'; |
| 8 | +import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; |
| 9 | +import { PortfolioDetailComponent } from './portfolio/portfolio-detail/portfolio-detail.component'; |
| 10 | +import { PortfolioResolverService } from './portfolio/portfolio-resolver.service'; |
| 11 | +import { StockDetailComponent } from './stocks/stock-detail/stock-detail.component'; |
| 12 | +import { StockResolverService } from './stocks/stock-resolver.service'; |
| 13 | + |
| 14 | +const routes: Routes = [ |
| 15 | + { path: '', redirectTo: '/portfolio', pathMatch: 'full' }, |
| 16 | + { path: 'auth', component: AuthComponent }, |
| 17 | + { |
| 18 | + path: 'portfolio', component: PortfolioComponent, resolve: { portfolioList: PortfolioResolverService }, canActivate: [AuthGuard], |
| 19 | + children: [ |
| 20 | + { |
| 21 | + path: ':id', |
| 22 | + component: PortfolioDetailComponent |
| 23 | + } |
| 24 | + ] |
| 25 | + }, |
| 26 | + { path: 'sip-calculator', component: SipComponent, canActivate: [AuthGuard] }, |
| 27 | + { |
| 28 | + path: 'stocks', component: StocksComponent, canActivate: [AuthGuard], resolve: { stockList: StockResolverService }, |
| 29 | + children: [ |
| 30 | + { |
| 31 | + path: ':id', |
| 32 | + component: StockDetailComponent |
| 33 | + } |
| 34 | + ] |
| 35 | + }, |
| 36 | + { path: 'not-found', component: PageNotFoundComponent }, |
| 37 | + { path: '**', redirectTo: 'not-found' } |
| 38 | +]; |
| 39 | + |
| 40 | +@NgModule({ |
| 41 | + imports: [RouterModule.forRoot(routes, {})], |
| 42 | + exports: [RouterModule] |
| 43 | +}) |
| 44 | +export class AppRoutingModule { } |
0 commit comments