What is the purpose of the sign "!" after after the "$" in angular observable?

65 Views Asked by At

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')!

0

There are 0 best solutions below