Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(router) migrate deprecated jsdoc tags #23187

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 43 additions & 24 deletions packages/router/src/config.ts
Expand Up @@ -12,9 +12,10 @@ import {PRIMARY_OUTLET} from './shared';
import {UrlSegment, UrlSegmentGroup} from './url_tree';

/**
* @whatItDoes Represents router configuration.
*
* @description
*
* Represents router configuration.
*
* `Routes` is an array of route configurations. Each one has the following properties:
*
* - `path` is a string that uses the route matcher DSL.
Expand All @@ -24,21 +25,21 @@ import {UrlSegment, UrlSegmentGroup} from './url_tree';
* - `redirectTo` is the url fragment which will replace the current matched segment.
* - `outlet` is the name of the outlet the component should be placed into.
* - `canActivate` is an array of DI tokens used to look up CanActivate handlers. See
* {@link CanActivate} for more info.
* `CanActivate` for more info.
* - `canActivateChild` is an array of DI tokens used to look up CanActivateChild handlers. See
* {@link CanActivateChild} for more info.
* `CanActivateChild` for more info.
* - `canDeactivate` is an array of DI tokens used to look up CanDeactivate handlers. See
* {@link CanDeactivate} for more info.
* `CanDeactivate` for more info.
* - `canLoad` is an array of DI tokens used to look up CanLoad handlers. See
* {@link CanLoad} for more info.
* `CanLoad` for more info.
* - `data` is additional data provided to the component via `ActivatedRoute`.
* - `resolve` is a map of DI tokens used to look up data resolvers. See {@link Resolve} for more
* - `resolve` is a map of DI tokens used to look up data resolvers. See `Resolve` for more
* info.
* - `runGuardsAndResolvers` defines when guards and resolvers will be run. By default they run only
* when the matrix parameters of the route change. When set to `paramsOrQueryParamsChange` they
* will also run when query params change. And when set to `always`, they will run every time.
* - `children` is an array of child route definitions.
* - `loadChildren` is a reference to lazy loaded child routes. See {@link LoadChildren} for more
* - `loadChildren` is a reference to lazy loaded child routes. See `LoadChildren` for more
* info.
*
* ### Simple Configuration
Expand Down Expand Up @@ -255,7 +256,7 @@ import {UrlSegment, UrlSegmentGroup} from './url_tree';
export type Routes = Route[];

/**
* @whatItDoes Represents the results of the URL matching.
* @description Represents the results of the URL matching.
*
* * `consumed` is an array of the consumed URL segments.
* * `posParams` is a map of positional parameters.
Expand All @@ -267,10 +268,10 @@ export type UrlMatchResult = {
};

/**
* @whatItDoes A function matching URLs
*
* @description
*
* A function matching URLs
*
* A custom URL matcher can be provided when a combination of `path` and `pathMatch` isn't
* expressive enough.
*
Expand All @@ -290,54 +291,72 @@ export type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route:
UrlMatchResult;

/**
* @whatItDoes Represents the static data associated with a particular route.
* See {@link Routes} for more details.
* @description
*
* Represents the static data associated with a particular route.
*
* See `Routes` for more details.
* @stable
*/
export type Data = {
[name: string]: any
};

/**
* @whatItDoes Represents the resolved data associated with a particular route.
* See {@link Routes} for more details.
* @description
*
* Represents the resolved data associated with a particular route.
*
* See `Routes` for more details.
* @stable
*/
export type ResolveData = {
[name: string]: any
};

/**
* @whatItDoes The type of `loadChildren`.
* See {@link Routes} for more details.
* @description
*
* The type of `loadChildren`.
*
* See `Routes` for more details.
* @stable
*/
export type LoadChildrenCallback = () =>
Type<any>| NgModuleFactory<any>| Promise<Type<any>>| Observable<Type<any>>;

/**
* @whatItDoes The type of `loadChildren`.
* See {@link Routes} for more details.
* @description
*
* The type of `loadChildren`.
*
* See `Routes` for more details.
* @stable
*/
export type LoadChildren = string | LoadChildrenCallback;

/**
* @whatItDoes The type of `queryParamsHandling`.
* See {@link RouterLink} for more details.
* @description
*
* The type of `queryParamsHandling`.
*
* See `RouterLink` for more details.
* @stable
*/
export type QueryParamsHandling = 'merge' | 'preserve' | '';

/**
* @whatItDoes The type of `runGuardsAndResolvers`.
* See {@link Routes} for more details.
* @description
*
* The type of `runGuardsAndResolvers`.
*
* See `Routes` for more details.
* @experimental
*/
export type RunGuardsAndResolvers = 'paramsChange' | 'paramsOrQueryParamsChange' | 'always';

/**
* See {@link Routes} for more details.
* See `Routes` for more details.
* @stable
*/
export interface Route {
Expand Down
22 changes: 9 additions & 13 deletions packages/router/src/directives/router_link.ts
Expand Up @@ -18,21 +18,15 @@ import {UrlTree} from '../url_tree';


/**
* @whatItDoes Lets you link to specific parts of your app.
* @description
*
* @howToUse
* Lets you link to specific routes in your app.
*
* Consider the following route configuration:
* `[{ path: 'user/:name', component: UserCmp }]`
*
* When linking to this `user/:name` route, you can write:
* `<a routerLink='/user/bob'>link to user component</a>`
*
* @description
* `[{ path: 'user/:name', component: UserCmp }]`.
* When linking to this `user/:name` route, you use the `RouterLink` directive.
*
* The RouterLink directives let you link to specific parts of your app.
*
* When the link is static, you can use the directive as follows:
* If the link is static, you can use the directive as follows:
* `<a routerLink="/user/bob">link to user component</a>`
*
* If you use dynamic values to generate the link, you can pass an array of path
Expand Down Expand Up @@ -158,9 +152,11 @@ export class RouterLink {
}

/**
* @whatItDoes Lets you link to specific parts of your app.
* @description
*
* Lets you link to specific routes in your app.
*
* See {@link RouterLink} for more information.
* See `RouterLink` for more information.
*
* @ngModule RouterModule
*
Expand Down
11 changes: 3 additions & 8 deletions packages/router/src/directives/router_link_active.ts
Expand Up @@ -16,17 +16,12 @@ import {RouterLink, RouterLinkWithHref} from './router_link';


/**
* @whatItDoes Lets you add a CSS class to an element when the link's route becomes active.
*
* @howToUse
*
* ```
* <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a>
* ```
*
* @description
*
* The RouterLinkActive directive lets you add a CSS class to an element when the link's route
* Lets you add a CSS class to an element when the link's route becomes active.
*
* This directive lets you add a CSS class to an element when the link's route
* becomes active.
*
* Consider the following example:
Expand Down
5 changes: 2 additions & 3 deletions packages/router/src/directives/router_outlet.ts
Expand Up @@ -13,10 +13,9 @@ import {ActivatedRoute} from '../router_state';
import {PRIMARY_OUTLET} from '../shared';

/**
* @whatItDoes Acts as a placeholder that Angular dynamically fills based on the current router
* state.
* @description
*
* @howToUse
* Acts as a placeholder that Angular dynamically fills based on the current router state.
*
* ```
* <router-outlet></router-outlet>
Expand Down