6: Get Data from a Server
[examples/angular-tour-of-heroes] / src / app / app.module.ts
1 import { BrowserModule } from '@angular/platform-browser';
2 import { NgModule } from '@angular/core';
3 import { AppRoutingModule } from './app-routing.module';
4 import { FormsModule } from '@angular/forms';
5 import { HttpClientModule } from '@angular/common/http';
6
7 import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
8 import { InMemoryDataService } from './in-memory-data.service';
9
10 import { AppComponent } from './app.component';
11 import { HeroesComponent } from './heroes/heroes.component';
12 import { HeroDetailComponent } from './hero-detail/hero-detail.component';
13 import { MessagesComponent } from './messages/messages.component';
14 import { DashboardComponent } from './dashboard/dashboard.component';
15 import { HeroSearchComponent } from './hero-search/hero-search.component';
16
17 @NgModule({
18   declarations: [
19     AppComponent,
20     HeroesComponent,
21     HeroDetailComponent,
22     MessagesComponent,
23     DashboardComponent,
24     HeroSearchComponent
25   ],
26   imports: [
27     BrowserModule,
28     AppRoutingModule,
29     FormsModule,
30     HttpClientModule,
31
32     // The HttpClientInMemoryWebApiModule module intercepts HTTP requests
33     // and returns simulated server responses.
34     // Remove it when a real server is ready to receive requests.
35     HttpClientInMemoryWebApiModule.forRoot(
36       InMemoryDataService, { dataEncapsulation: false }
37     )
38   ],
39   providers: [],
40   bootstrap: [AppComponent]
41 })
42 export class AppModule { }