|
1 | 1 | import { BrowserModule } from '@angular/platform-browser'; |
2 | 2 | import { NgModule } from '@angular/core'; |
3 | | -import { FormsModule } from '@angular/forms'; |
4 | 3 | import { HttpModule } from '@angular/http'; |
5 | 4 | import { RouterModule } from '@angular/router'; |
6 | 5 |
|
7 | 6 | import { AppComponent } from './app.component'; |
8 | | -import { ProductListComponent } from './products/product-list.component'; |
9 | | -import { ConvertToSpacesPipe } from './shared/convert-to-spaces.pipe'; |
10 | | -import { StarComponent } from './shared/star.component'; |
11 | | -import { ProductDetailComponent } from './products/product-detail.component'; |
12 | 7 | import { WelcomeComponent } from './home/welcome.component'; |
13 | | -import { ProductGuardService } from './products/product-guard.service'; |
| 8 | +import { ProductModule } from './products/product.module'; |
14 | 9 |
|
15 | 10 | @NgModule({ |
16 | 11 | declarations: [ |
17 | 12 | AppComponent, |
18 | | - ProductListComponent, |
19 | | - ConvertToSpacesPipe, |
20 | | - StarComponent, |
21 | | - ProductDetailComponent, |
22 | 13 | WelcomeComponent |
23 | 14 | ], |
24 | 15 | imports: [ |
25 | 16 | BrowserModule, |
26 | | - FormsModule, |
27 | 17 | HttpModule, |
28 | 18 | RouterModule.forRoot([ |
29 | | - { path: 'products', component: ProductListComponent }, |
30 | | - { path: 'products/:id', |
31 | | - canActivate: [ ProductGuardService ], |
32 | | - component: ProductDetailComponent }, |
33 | 19 | { path: 'welcome', component: WelcomeComponent }, |
34 | 20 | { path: '', redirectTo: 'welcome', pathMatch: 'full'}, |
35 | 21 | { path: '**', redirectTo: 'welcome', pathMatch: 'full'} |
36 | | - ]) |
| 22 | + ]), |
| 23 | + ProductModule |
37 | 24 | ], |
38 | | - providers: [ProductGuardService], |
39 | 25 | bootstrap: [AppComponent] |
40 | 26 | }) |
41 | 27 | export class AppModule { } |
0 commit comments