From ff028f0b39f7ef8471a44f8550e1ed7f84206554 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Thu, 20 Sep 2018 14:50:32 +0100 Subject: [PATCH] docs(router): move examples to `@usageNotes` (#26039) PR Close #26039 --- packages/router/src/config.ts | 1 + packages/router/src/router.ts | 18 +++++++++++++----- packages/router/src/router_module.ts | 1 + packages/router/src/router_state.ts | 2 ++ packages/router/src/url_tree.ts | 4 +++- .../testing/src/router_testing_module.ts | 1 + 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/router/src/config.ts b/packages/router/src/config.ts index 047c73bf9c..082c466ce3 100644 --- a/packages/router/src/config.ts +++ b/packages/router/src/config.ts @@ -43,6 +43,7 @@ import {UrlSegment, UrlSegmentGroup} from './url_tree'; * - `loadChildren` is a reference to lazy loaded child routes. See `LoadChildren` for more * info. * + * @usageNotes * ### Simple Configuration * * ``` diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 44ff3a07df..30b657dc4d 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -374,12 +374,14 @@ export class Router { get url(): string { return this.serializeUrl(this.currentUrlTree); } /** @internal */ - triggerEvent(e: Event): void { (this.events as Subject).next(e); } + triggerEvent(event: Event): void { (this.events as Subject).next(event); } /** * Resets the configuration used for navigation and generating links. * - * ### Usage + * @usageNotes + * + * ### Example * * ``` * router.resetConfig([ @@ -414,7 +416,9 @@ export class Router { * When given an activate route, applies the given commands starting from the route. * When not given a route, applies the given command starting from the root. * - * ### Usage + * @usageNotes + * + * ### Example * * ``` * // create /team/33/user/11 @@ -486,7 +490,9 @@ export class Router { * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * - * ### Usage + * @usageNotes + * + * ### Example * * ``` * router.navigateByUrl("/team/33/user/11"); @@ -522,7 +528,9 @@ export class Router { * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * - * ### Usage + * @usageNotes + * + * ### Example * * ``` * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); diff --git a/packages/router/src/router_module.ts b/packages/router/src/router_module.ts index 2d90da6421..bc80d4f985 100644 --- a/packages/router/src/router_module.ts +++ b/packages/router/src/router_module.ts @@ -225,6 +225,7 @@ export function provideForRootGuard(router: Router): any { * * Registers routes. * + * @usageNotes * ### Example * * ``` diff --git a/packages/router/src/router_state.ts b/packages/router/src/router_state.ts index 658e74e9f0..c1a83c743d 100644 --- a/packages/router/src/router_state.ts +++ b/packages/router/src/router_state.ts @@ -26,6 +26,7 @@ import {Tree, TreeNode} from './utils/tree'; * RouterState is a tree of activated routes. Every node in this tree knows about the "consumed" URL * segments, the extracted parameters, and the resolved data. * + * @usageNotes * ### Example * * ``` @@ -340,6 +341,7 @@ export class ActivatedRouteSnapshot { * This is a tree of activated route snapshots. Every node in this tree knows about * the "consumed" URL segments, the extracted parameters, and the resolved data. * + * @usageNotes * ### Example * * ``` diff --git a/packages/router/src/url_tree.ts b/packages/router/src/url_tree.ts index 958c3f32cb..3819f3f340 100644 --- a/packages/router/src/url_tree.ts +++ b/packages/router/src/url_tree.ts @@ -82,6 +82,7 @@ function containsSegmentGroupHelper( * serialized tree. * UrlTree is a data structure that provides a lot of affordances in dealing with URLs * + * @usageNotes * ### Example * * ``` @@ -173,7 +174,8 @@ export class UrlSegmentGroup { * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix * parameters associated with the segment. * - * ## Example + * @usageNotes + * ### Example * * ``` * @Component({templateUrl:'template.html'}) diff --git a/packages/router/testing/src/router_testing_module.ts b/packages/router/testing/src/router_testing_module.ts index 4f2935a483..56f5f504cf 100644 --- a/packages/router/testing/src/router_testing_module.ts +++ b/packages/router/testing/src/router_testing_module.ts @@ -147,6 +147,7 @@ export function setupTestingRouter( * It provides spy implementations of `Location`, `LocationStrategy`, and {@link * NgModuleFactoryLoader}. * + * @usageNotes * ### Example * * ```