File tree Expand file tree Collapse file tree 2 files changed +2
-3
lines changed
aio/content/examples/toh-pt6/src/app Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,7 @@ export class HeroService {
104
104
105
105
// #docregion deleteHero
106
106
/** DELETE: delete the hero from the server */
107
- deleteHero ( hero : Hero | number ) : Observable < Hero > {
108
- const id = typeof hero === 'number' ? hero : hero . id ;
107
+ deleteHero ( id : number ) : Observable < Hero > {
109
108
const url = `${ this . heroesUrl } /${ id } ` ;
110
109
111
110
return this . http . delete < Hero > ( url , this . httpOptions ) . pipe (
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export class HeroesComponent implements OnInit {
36
36
// #docregion delete
37
37
delete ( hero : Hero ) : void {
38
38
this . heroes = this . heroes . filter ( h => h !== hero ) ;
39
- this . heroService . deleteHero ( hero ) . subscribe ( ) ;
39
+ this . heroService . deleteHero ( hero . id ) . subscribe ( ) ;
40
40
}
41
41
// #enddocregion delete
42
42
You can’t perform that action at this time.
0 commit comments