Currently, I am working on the angular heroes tutorial provided in the angular documentation and encountering an error.
An issue has been detected, which states that the object is possibly 'null'.
getHero(): void {
const id = +this.route.snapshot.paramMap.get('id');
this.heroService.getHero(id)
.subscribe(hero => this.hero = hero);
}
This is located in the hero-detail.component.ts file.
If you would like to view the full code snippet, please follow this link to the hero-detail component.
I have come across suggestions advising to set it to false in the config.json, but I am seeking assistance on how to resolve this without simply suppressing the issue.
Thank you in advance for your help.