diff --git a/aio/content/examples/toh-pt6/src/app/in-memory-data.service.ts b/aio/content/examples/toh-pt6/src/app/in-memory-data.service.ts index 9679f21055..c590be5d65 100644 --- a/aio/content/examples/toh-pt6/src/app/in-memory-data.service.ts +++ b/aio/content/examples/toh-pt6/src/app/in-memory-data.service.ts @@ -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 = [ diff --git a/aio/content/tutorial/toh-pt6.md b/aio/content/tutorial/toh-pt6.md index c1c8cdea61..1c290bcb05 100644 --- a/aio/content/tutorial/toh-pt6.md +++ b/aio/content/tutorial/toh-pt6.md @@ -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: + + + ng generate service InMemoryData + + +This class has the following content: