add Edit the hero
This commit is contained in:
parent
620a97cc80
commit
b6a7988fbe
|
@ -6,7 +6,8 @@ import { HeroesComponent } from "./heroes/heroes.component";
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrl: './app.component.css',
|
styleUrl: './app.component.css',
|
||||||
imports: [HeroesComponent]
|
imports: [HeroesComponent],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class App {
|
export class App {
|
||||||
protected title = 'Tour of Heroes';
|
protected title = 'Tour of Heroes';
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
<h2>{{hero.name | uppercase}} Details</h2>
|
<h2>{{hero.name | uppercase}} Details</h2>
|
||||||
<div><span>id: </span>{{hero.id}}</div>
|
<div><span>id: </span>{{hero.id}}</div>
|
||||||
<div><span>name: </span>{{hero.name}}</div>
|
<div>
|
||||||
|
<label for="name">Hero name: </label>
|
||||||
|
<input id="name" [(ngModel)]="hero.name" placeholder="name">
|
||||||
|
</div>
|
|
@ -1,10 +1,12 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Hero } from '../hero';
|
import { Hero } from '../hero';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-heroes',
|
selector: 'app-heroes',
|
||||||
templateUrl: './heroes.component.html',
|
templateUrl: './heroes.component.html',
|
||||||
styleUrls: ['./heroes.component.css']
|
styleUrls: ['./heroes.component.css'],
|
||||||
|
imports: [CommonModule]
|
||||||
})
|
})
|
||||||
export class HeroesComponent {
|
export class HeroesComponent {
|
||||||
hero: Hero = {
|
hero: Hero = {
|
||||||
|
|
Loading…
Reference in New Issue