docs(router): Move ActivatedRoute example to mini-app (#29755)

PR Close #29755
This commit is contained in:
Frederik Prijck
2019-04-07 21:10:28 +02:00
committed by Alex Rickabaugh
parent eccc41c5cf
commit 9a807bd26a
4 changed files with 95 additions and 11 deletions

View File

@ -91,17 +91,8 @@ export function createEmptyStateSnapshot(
* Contains the information about a route associated with a component loaded in an
* outlet. An `ActivatedRoute` can also be used to traverse the router state tree.
*
* ```
* @Component({...})
* class MyComponent {
* constructor(route: ActivatedRoute) {
* const id: Observable<string> = route.params.pipe(map(p => p.id));
* const url: Observable<string> = route.url.pipe(map(segments => segments.join('')));
* // route.data includes both `data` and `resolve`
* const user = route.data.pipe(map(d => d.user));
* }
* }
* ```
* {@example router/activated-route/module.ts region="activated-route"
* header="activated-route.component.ts" linenums="false"}
*
* @publicApi
*/