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
16 @NgModule({
17   declarations: [
18     AppComponent,
19     HeroesComponent,
20     HeroDetailComponent,
21     MessagesComponent,
22     DashboardComponent
23   ],
24   imports: [
25     BrowserModule,
26     AppRoutingModule,
27     FormsModule,
28     HttpClientModule,
29
30     // The HttpClientInMemoryWebApiModule module intercepts HTTP requests
31     // and returns simulated server responses.
32     // Remove it when a real server is ready to receive requests.
33     HttpClientInMemoryWebApiModule.forRoot(
34       InMemoryDataService, { dataEncapsulation: false }
35     )
36   ],
37   providers: [],
38   bootstrap: [AppComponent]
39 })
40 export class AppModule { }