projects
/
examples
/
angular-tour-of-heroes
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69d8339
)
Hero in HeroDetailComponent can be undefined: resetting prior to fetching
author
Kai Moritz
<kai@juplo.de>
Sun, 10 May 2020 20:42:52 +0000
(22:42 +0200)
committer
Kai Moritz
<kai@juplo.de>
Mon, 11 May 2020 16:23:16 +0000
(18:23 +0200)
src/app/hero-detail/hero-detail.component.ts
patch
|
blob
|
history
diff --git
a/src/app/hero-detail/hero-detail.component.ts
b/src/app/hero-detail/hero-detail.component.ts
index
d4c7289
..
4bbfe2e
100644
(file)
--- a/
src/app/hero-detail/hero-detail.component.ts
+++ b/
src/app/hero-detail/hero-detail.component.ts
@@
-12,7
+12,7
@@
import { Hero } from '../hero';
})
export class HeroDetailComponent implements OnInit {
- hero: Hero;
+ hero: Hero
| undefined
;
constructor(
private route: ActivatedRoute,
@@
-27,6
+27,7
@@
export class HeroDetailComponent implements OnInit {
getHero(): void {
this.route.params.subscribe(params => {
const id: number = +params.id;
+ this.hero = undefined;
this.heroService.getHero(id).subscribe(hero => this.hero = hero);
});
}