app.module.ts
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
//Http Service
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
// Imports for loading & configuring the in-memory web api
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './services/mocks/in-memory-data.service';
//Routing
import { RouterModule } from '@angular/router';
@NgModule({
imports: [ BrowserModule ,
//Http Service
HttpModule,
FormsModule,
RouterModule.forRoot([
{ path: 'home', component: AppComponent},
// { path: 'detail', component: HeroDetailComponent} ,
{ path: 'detail/:id', component: HeroDetailComponent} //Parameterized route
]),
InMemoryWebApiModule.forRoot(
InMemoryDataService
,{ passThruUnknownUrl: true} //this will use the normal XHRBackend if the collection in the mock data can't be found
)],
declarations: [ AppComponent,
HeroDetailComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }