ngOnInit(): void { // get hero when `id` param changes this.route.paramMap.subscribe(pmap => this.getHero(pmap.get('id'))); }