docs: add HttpClientModule import code to services tutorial (#24854)

To be able to copy and paste.

PR Close #24854
This commit is contained in:
Ana María Martínez Gómez 2018-07-12 15:00:54 +02:00 committed by Jason Aden
parent de03abbd34
commit cc55d609ce
2 changed files with 13 additions and 4 deletions

View File

@ -3,7 +3,9 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
// #docregion import-http-client
import { HttpClientModule } from '@angular/common/http';
// #enddocregion import-http-client
// #docregion import-in-mem-stuff
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

View File

@ -13,11 +13,18 @@ When you're done with this page, the app should look like this <live-example></l
`HttpClient` is Angular's mechanism for communicating with a remote server over HTTP.
To make `HttpClient` available everywhere in the app,
To make `HttpClient` available everywhere in the app:
* open the root `AppModule`,
* import the `HttpClientModule` symbol from `@angular/common/http`,
* add it to the `@NgModule.imports` array.
* open the root `AppModule`
* import the `HttpClientModule` symbol from `@angular/common/http`
<code-example
path="toh-pt6/src/app/app.module.ts"
region="import-http-client"
title="src/app/app.module.ts (Http Client import)">
</code-example>
* add it to the `@NgModule.imports` array
## Simulate a data server