docs: replace from class hero to interface with accordance with # 344022 (#34294)

Fixes #21186

PR Close #34294
This commit is contained in:
ajitsinghkaler 2019-12-07 19:50:31 +05:30 committed by atscott
parent 55037d1107
commit ebcd59ae4f
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
// #docregion item-class
export class Item {
export interface Item {
id: number;
name: string;
}

View File

@ -67,17 +67,17 @@ So add an `<app-heroes>` element to the `AppComponent` template file, just below
Assuming that the CLI `ng serve` command is still running,
the browser should refresh and display both the application title and the hero name.
## Create a Hero class
## Create a Hero interface
A real hero is more than a name.
Create a `Hero` class in its own file in the `src/app` folder.
Create a `Hero` interface in its own file in the `src/app` folder.
Give it `id` and `name` properties.
<code-example path="toh-pt1/src/app/hero.ts" header="src/app/hero.ts"></code-example>
Return to the `HeroesComponent` class and import the `Hero` class.
Return to the `HeroesComponent` class and import the `Hero` interface.
Refactor the component's `hero` property to be of type `Hero`.
Initialize it with an `id` of `1` and the name `Windstorm`.