Skip to content

Tutorial toh-pt6 directs reader to delete mock-heroes.ts when it's still being used #29535

@solarjoe

Description

@solarjoe

There is a small issues with the current toh-pt6 HTTP

The doc states

This file replaces mock-heroes.ts, which is now safe to delete.

This is not true at that point as in hero.service.ts there is the import

import { HEROES } from './mock-heroes';

and HEROES is still used in

getHero(id: number): Observable<Hero> {
    ...
    return of(HEROES.find(hero => hero.id === id));
  }

Later in the tutorial this function is replaced but until then the code does not work.

E.g. at the end of section Get heroes with HttpClient the doc states

Refresh the browser. The hero data should successfully load from the mock server.

but the code is broken at this point.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions