docs: add missing instruction in HTTP section (#25715)

PR Close #25715
This commit is contained in:
Frederik Schlemmer 2018-09-06 07:53:08 +02:00 committed by Andrew Kushnir
parent edb50a2f51
commit ac1988d8e6
2 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,11 @@
// #docregion , init
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { Hero } from './hero';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class InMemoryDataService implements InMemoryDbService {
createDb() {
const heroes = [

View File

@ -77,8 +77,13 @@ _after importing the `HttpClientModule`_,
The `forRoot()` configuration method takes an `InMemoryDataService` class
that primes the in-memory database.
The _Tour of Heroes_ sample creates such a class
`src/app/in-memory-data.service.ts` which has the following content:
The class `src/app/in-memory-data.service.ts` is generated by the following command:
<code-example language="sh" class="code-shell">
ng generate service InMemoryData
</code-example>
This class has the following content:
<code-example path="toh-pt6/src/app/in-memory-data.service.ts" region="init" header="src/app/in-memory-data.service.ts" linenums="false"></code-example>