We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b3bd62 commit 0deda48Copy full SHA for 0deda48
src/app/heroes/hero-detail/hero-detail.component.ts
@@ -19,12 +19,9 @@ export class HeroDetailComponent implements OnInit {
19
}
20
21
ngOnInit() {
22
- this.activatedRoute.params.subscribe((params: any) => {
23
- if (params['id']) {
24
- this.heroService.getHeroById(params['id']).subscribe((hero: Hero) => {
25
- this.hero = hero;
26
- });
27
- }
+ const heroId = this.activatedRoute.snapshot.paramMap.get('id');
+ this.heroService.getHeroById(heroId).subscribe((hero: Hero) => {
+ this.hero = hero;
28
});
29
30
0 commit comments