9fa5aad8346145e8a61e9f140cd7e9b346869f95
[examples/angular-tutorial] / src / app / app.module.ts
1 import { BrowserModule } from '@angular/platform-browser';
2 import { NgModule } from '@angular/core';
3 import { RouterModule } from '@angular/router';
4
5 import { AppComponent } from './app.component';
6 import { TopBarComponent } from './top-bar/top-bar.component';
7 import { ProductListComponent } from './product-list/product-list.component';
8 import { ProductDetailsComponent } from './product-details/product-details.component';
9 import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
10 import { CartComponent } from './cart/cart.component';
11
12 @NgModule({
13   declarations: [
14     AppComponent,
15     TopBarComponent,
16     ProductListComponent,
17     ProductDetailsComponent,
18     ProductAlertsComponent,
19     CartComponent
20   ],
21   imports: [
22     BrowserModule,
23     RouterModule.forRoot([
24       { path: '', component: ProductListComponent },
25       { path: 'products/:productId', component: ProductDetailsComponent },
26       { path: 'cart', component: CartComponent }
27     ])
28   ],
29   providers: [],
30   bootstrap: [AppComponent]
31 })
32 export class AppModule { }