docs: Updated router guide content and examples for paramMap

and queryParamMap, tracing, and incidental improvements.
closes #16991 and #16259 which it also fixes.
This commit is contained in:
Brandon Roberts
2017-06-18 21:09:02 -05:00
committed by Matias Niemelä
parent 4268c82898
commit 8d01db4638
38 changed files with 487 additions and 246 deletions

View File

@ -1,7 +1,7 @@
// #docregion
import 'rxjs/add/operator/switchMap';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Location } from '@angular/common';
import { Hero } from './hero';
@ -22,8 +22,8 @@ export class HeroDetailComponent implements OnInit {
) {}
ngOnInit(): void {
this.route.params
.switchMap((params: Params) => this.heroService.getHero(+params['id']))
this.route.paramMap
.switchMap((params: ParamMap) => this.heroService.getHero(+params.get('id')))
.subscribe(hero => this.hero = hero);
}