I saw in the Angular tour of heroes tutorial, they declare hero$!: Observable<Hero>;
Why is there !
sign after the $
?
They are also initializing the hero observable in the ngOnInit
ngOnInit() {
this.hero$ = this.route.paramMap.pipe(
switchMap((params: ParamMap) =>
this.service.getHero(params.get('id')!))
);
}
And there, we also see the !
sign on params.get('id')!