add Create a Hero interface
This commit is contained in:
parent
1a5f159a22
commit
632ad58e1b
|
@ -0,0 +1,4 @@
|
||||||
|
export interface Hero {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
}
|
|
@ -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>
|
|
@ -1,12 +1,14 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { Hero } from './hero';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-heroes',
|
selector: 'app-heroes',
|
||||||
templateUrl: './heroes.component.html',
|
templateUrl: './heroes.component.html',
|
||||||
styleUrl: './heroes.component.css'
|
styleUrls: ['./heroes.component.css']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class HeroesComponent {
|
export class HeroesComponent {
|
||||||
hero = 'Windstorm';
|
hero: Hero = {
|
||||||
|
id: 1,
|
||||||
|
name: 'Windstorm'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue