add Create a Hero interface

This commit is contained in:
Костя 2025-06-17 17:37:57 +03:00
parent 1a5f159a22
commit 632ad58e1b
3 changed files with 13 additions and 5 deletions

4
src/app/heroes/hero.ts Normal file
View File

@ -0,0 +1,4 @@
export interface Hero {
id: number;
name: string;
}

View File

@ -1 +1,3 @@
<h2>{{hero}}</h2>
<h2>{{hero.name}} Details</h2>
<div><span>id: </span>{{hero.id}}</div>
<div><span>name: </span>{{hero.name}}</div>

View File

@ -1,12 +1,14 @@
import { Component } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrl: './heroes.component.css'
styleUrls: ['./heroes.component.css']
})
export class HeroesComponent {
hero = 'Windstorm';
hero: Hero = {
id: 1,
name: 'Windstorm'
};
}