Angular Tour of heroes: ai continué sur HTTP

* ajout d'un héro
  * suppression d'un héro
  * mise à jour d'un héro
This commit is contained in:
2019-10-27 11:54:33 +01:00
parent 81405d7daa
commit 286898f2eb
6 changed files with 102 additions and 0 deletions

View File

@ -1,10 +1,21 @@
<h2>My Heroes</h2>
<div>
<label>Hero name:
<input #heroName />
</label>
<!-- (click) passes input value to add() and then clears the input -->
<button (click)="add(heroName.value); heroName.value=''">
add
</button>
</div>
<ul class="heroes">
<li *ngFor="let hero of heroes">
<a routerLink="/detail/{{hero.id}}">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</a>
<button class="delete" title="delete hero"
(click)="delete(hero)">x</button>
</li>
</ul>