Hi all,

I'm writing to ask some clarifications about the sample code published in 
the "Routing and navigation" on the angular.io website.

Full URL is: https://angular.io/docs/ts/latest/guide/router.html

Here is the code where I need your idea:

ngOnInit() {
  this.route.params
    // (+) converts string 'id' to a number
    .switchMap((params: Params) => this.service.getHero(+params['id']))
    .subscribe((hero: Hero) => this.hero = hero);
}


Since I'm a novice on TypeScript this is quite confusing for me; the code 
above should get the passed parameters through a navigation link and the 
parameter read by an observable.

The questions:
- How I have to remanage the code to get just the parameter and put it on a 
property? 
- I cannot realize what the switchMap and subscribe method are exactly; can 
someone explain me or point me to a documentation about? Note that I 
already took a look at http://reactivex.io

Thank you very much for help!

Francesco

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to