Answers for "finally suscribe typescript"

0

finally suscribe typescript

So the subscribe function takes three parameters:
onNext
onError
onCompleted

this._heroService.addHero(this.hero).subscribe(
      hero=> this.hero= hero,
      error => console.log("Error: ", error),
      function(){ this._router.navigate(['HeroDetail', { id: this.hero.id }]) }
    );

or 

this._heroService.addHero(this.hero).subscribe({
	next: event => { console.log(event) }, 
  	error: error => { console.log(error) }, 
   	complete: () => { console.log('complete') }
});
Posted by: Guest on March-05-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language