docs(API): 翻译 router

This commit is contained in:
Zhicheng Wang 2018-08-31 16:21:38 +08:00
parent 4fc343f796
commit acfc14aafa
2 changed files with 236 additions and 107 deletions

View File

@ -2,106 +2,104 @@
按照下列优先级进行翻译: 按照下列优先级进行翻译:
URL|浏览量|占比 状态|URL|浏览量|占比
---|---|---- ---|---|---|----
common/http/HttpClient | 7,263 | 2.26 [x] |common/http/HttpClient | 7,263 | 2.26
common/NgForOf | 6,281 | 1.95 [x] |common/NgForOf | 6,281 | 1.95
forms/NgModel | 5,648 | 1.75 [x] |forms/NgModel | 5,648 | 1.75
core/Component | 5,582 | 1.73 [x] |core/Component | 5,582 | 1.73
common/NgIf | 4,940 | 1.53 [x] |common/NgIf | 4,940 | 1.53
core/NgModule | 4,097 | 1.27 [x] |core/NgModule | 4,097 | 1.27
router/Router | 4,049 | 1.26 [x] |router/Router | 4,049 | 1.26
animations/animate | 3,817 | 1.19 [ ] |animations/animate | 3,817 | 1.19
common/NgClass | 3,715 | 1.15 [ ] |common/NgClass | 3,715 | 1.15
common/DatePipe | 3,576 | 1.11 [ ] |common/DatePipe | 3,576 | 1.11
/docs/ts/latest | 3,489 | 1.08 [ ] |forms/FormsModule | 3,381 | 1.05
forms/FormsModule | 3,381 | 1.05 [x] |core/Input | 3,354 | 1.04
core/Input | 3,354 | 1.04 [x] |core/EventEmitter | 3,202 | 0.99
core/EventEmitter | 3,202 | 0.99 [ ] |core/Injectable | 3,177 | 0.99
core/Injectable | 3,177 | 0.99 [ ] |forms/FormGroup | 3,096 | 0.96
forms/FormGroup | 3,096 | 0.96 [ ] |forms/FormControl | 3,034 | 0.94
forms/FormControl | 3,034 | 0.94 [ ] |router/ActivatedRoute | 2,993 | 0.93
router/ActivatedRoute | 2,993 | 0.93 [ ] |forms/AbstractControl | 2,930 | 0.91
forms/AbstractControl | 2,930 | 0.91 [ ] |router/RouterLink | 2,929 | 0.91
router/RouterLink | 2,929 | 0.91 [ ] |core/ViewChild | 2,870 | 0.89
core/ViewChild | 2,870 | 0.89 [x] |core/Directive | 2,767 | 0.86
core/Directive | 2,767 | 0.86 [ ] |router/Routes | 2,331 | 0.72
router/Routes | 2,331 | 0.72 [ ] |router/RouterModule | 2,227 | 0.69
router/RouterModule | 2,227 | 0.69 [ ] |router/Route | 2,223 | 0.69
router/Route | 2,223 | 0.69 [ ] |common/http/HttpClientModule | 2,167 | 0.67
http/Http | 2,220 | 0.69 [ ] |core/ElementRef | 2,163 | 0.67
common/http/HttpClientModule | 2,167 | 0.67 [ ] |core/OnInit | 2,136 | 0.66
core/ElementRef | 2,163 | 0.67 [ ] |common/UpperCasePipe | 2,078 | 0.65
core/OnInit | 2,136 | 0.66 [ ] |common/NgStyle | 1,935 | 0.60
common/UpperCasePipe | 2,078 | 0.65 [ ] |router/RouterOutlet | 1,908 | 0.59
common/NgStyle | 1,935 | 0.60 [ ] |forms/Validators | 1,900 | 0.59
router/RouterOutlet | 1,908 | 0.59 [ ] |common/http/HttpHeaders | 1,790 | 0.56
forms/Validators | 1,900 | 0.59 [x] |core/Pipe | 1,673 | 0.52
common/http/HttpHeaders | 1,790 | 0.56 [ ] |common/NgSwitch | 1,670 | 0.52
core/Pipe | 1,673 | 0.52 [ ] |forms/NgForm | 1,597 | 0.50
common/NgSwitch | 1,670 | 0.52 [ ] |core/Renderer2 | 1,562 | 0.49
forms/NgForm | 1,597 | 0.50 [x] |core/HostListener | 1,501 | 0.47
core/Renderer2 | 1,562 | 0.49 [ ] |common/AsyncPipe | 1,447 | 0.45
core/HostListener | 1,501 | 0.47 [ ] |core/ViewContainerRef | 1,367 | 0.42
common/AsyncPipe | 1,447 | 0.45 [ ] |common/NgTemplateOutlet | 1,337 | 0.42
core/ViewContainerRef | 1,367 | 0.42 [ ] |common/Location | 1,306 | 0.41
common/NgTemplateOutlet | 1,337 | 0.42 [ ] |platform-browser/BrowserModule | 1,281 | 0.40
common/Location | 1,306 | 0.41 [ ] |common/DecimalPipe | 1,275 | 0.40
platform-browser/BrowserModule | 1,281 | 0.40 [ ] |common/CurrencyPipe | 1,260 | 0.39
common/DecimalPipe | 1,275 | 0.40 [ ] |router/RouterLinkActive | 1,231 | 0.38
common/CurrencyPipe | 1,260 | 0.39 [ ] |core/TemplateRef | 1,212 | 0.38
router/RouterLinkActive | 1,231 | 0.38 [ ] |forms/FormBuilder | 1,205 | 0.37
core/TemplateRef | 1,212 | 0.38 [ ] |common/http/HttpParams | 1,131 | 0.35
forms/FormBuilder | 1,205 | 0.37 [ ] |core/OnChanges | 1,116 | 0.35
common/http/HttpParams | 1,131 | 0.35 [ ] |forms/FormControlName | 1,082 | 0.34
core/OnChanges | 1,116 | 0.35 [x] |core/Output | 1,067 | 0.33
forms/FormControlName | 1,082 | 0.34 [ ] |common/http/HttpInterceptor | 968 | 0.30
core/Output | 1,067 | 0.33 [ ] |common/http/HttpRequest | 925 | 0.29
common/http/HttpInterceptor | 968 | 0.30 [ ] |router/CanActivate | 863 | 0.27
common/http/HttpRequest | 925 | 0.29 [ ] |router | 848 | 0.26
router/CanActivate | 863 | 0.27 [ ] |animations/style | 804 | 0.25
router | 848 | 0.26 [ ] |common/SlicePipe | 799 | 0.25
animations/style | 804 | 0.25 [ ] |router/Event | 796 | 0.25
common/SlicePipe | 799 | 0.25 [ ] |common/JsonPipe | 793 | 0.25
router/Event | 796 | 0.25 [ ] |forms/FormArray | 792 | 0.25
common/JsonPipe | 793 | 0.25 [ ] |common/CommonModule | 787 | 0.24
forms/FormArray | 792 | 0.25 [ ] |router/NavigationExtras | 776 | 0.24
common/CommonModule | 787 | 0.24 [x] |core/HostBinding | 732 | 0.23
router/NavigationExtras | 776 | 0.24 [x] |core/ContentChild | 719 | 0.22
core/HostBinding | 732 | 0.23 [x] |core/ViewChildren | 717 | 0.22
core/ContentChild | 719 | 0.22 [ ] |common/http/HttpResponse | 714 | 0.22
core/ViewChildren | 717 | 0.22 [ ] |router/ActivatedRouteSnapshot | 700 | 0.22
common/http/HttpResponse | 714 | 0.22 [ ] |common/http | 683 | 0.21
router/ActivatedRouteSnapshot | 700 | 0.22 [ ] |core/ChangeDetectorRef | 670 | 0.21
common/http | 683 | 0.21 [ ] |router/NavigationStart | 663 | 0.21
core/ChangeDetectorRef | 670 | 0.21 [ ] |common/formatDate | 662 | 0.21
router/NavigationStart | 663 | 0.21 [ ] |core/ComponentFactoryResolver | 638 | 0.20
common/formatDate | 662 | 0.21 [ ] |forms/Form | 635 | 0.20
core/ComponentFactoryResolver | 638 | 0.20 [ ] |common/http/HttpErrorResponse | 629 | 0.20
forms/Form | 635 | 0.20 [ ] |core/QueryList | 620 | 0.19
common/http/HttpErrorResponse | 629 | 0.20 [ ] |forms | 618 | 0.19
core/QueryList | 620 | 0.19 [ ] |animations/state | 598 | 0.19
forms | 618 | 0.19 [ ] |common | 596 | 0.19
animations/state | 598 | 0.19 [ ] |router/LoadChildren | 593 | 0.18
common | 596 | 0.19 [ ] |router/ParamMap | 588 | 0.18
router/LoadChildren | 593 | 0.18 [ ] |animations/trigger | 584 | 0.18
router/ParamMap | 588 | 0.18 [ ] |router/RouterLinkWithHref | 584 | 0.18
animations/trigger | 584 | 0.18 [ ] |core/AfterViewInit | 579 | 0.18
router/RouterLinkWithHref | 584 | 0.18 [ ] |forms/ReactiveFormsModule | 576 | 0.18
core/AfterViewInit | 579 | 0.18 [ ] |common/http/HTTP_INTERCEPTORS | 574 | 0.18
forms/ReactiveFormsModule | 576 | 0.18 [ ] |platform-browser/DomSanitizer | 573 | 0.18
common/http/HTTP_INTERCEPTORS | 574 | 0.18 [ ] |core/PipeTransform | 572 | 0.18
platform-browser/DomSanitizer | 573 | 0.18 [ ] |core/SimpleChange | 570 | 0.18
core/PipeTransform | 572 | 0.18 [ ] |core/SimpleChanges | 568 | 0.18
core/SimpleChange | 570 | 0.18 [ ] |forms/NgSelectOption | 560 | 0.17
core/SimpleChanges | 568 | 0.18 [ ] |common/PercentPipe | 557 | 0.17
forms/NgSelectOption | 560 | 0.17 [ ] |forms/ValidatorFn | 557 | 0.17
common/PercentPipe | 557 | 0.17 [ ] |http/RequestOptionsArgs | 551 | 0.17
forms/ValidatorFn | 557 | 0.17 [ ] |animations/animation | 549 | 0.17
http/RequestOptionsArgs | 551 | 0.17 [ ] |common/NgSwitchCase | 521 | 0.16
animations/animation | 549 | 0.17 [ ] |core/testing/async | 518 | 0.16
common/NgSwitchCase | 521 | 0.16
core/testing/async | 518 | 0.16
## 翻译方式 ## 翻译方式
@ -111,4 +109,4 @@ core/testing/async | 518 | 0.16
## 翻译内容 ## 翻译内容
优先翻译函数主形态(如在 `common/http/src/client.ts` 中它通常都是重载形式中的最后一个),先不翻译各个重载形态,否则工作量太大 优先翻译函数主形态(如在 `common/http/src/client.ts` 中它通常都是重载形式中的最后一个),可以先不翻译各个重载形态。

View File

@ -34,14 +34,18 @@ import {TreeNode, nodeChildrenAsMap} from './utils/tree';
* *
* Represents the extra options used during navigation. * Represents the extra options used during navigation.
* *
* *
*/ */
export interface NavigationExtras { export interface NavigationExtras {
/** /**
* Enables relative navigation from the current ActivatedRoute. * Enables relative navigation from the current ActivatedRoute.
* *
*
*
* Configuration: * Configuration:
* *
*
*
* ``` * ```
* [{ * [{
* path: 'parent', * path: 'parent',
@ -58,6 +62,8 @@ export interface NavigationExtras {
* *
* Navigate to list route from child route: * Navigate to list route from child route:
* *
* `child` `list`
*
* ``` * ```
* @Component({...}) * @Component({...})
* class ChildComponent { * class ChildComponent {
@ -74,6 +80,8 @@ export interface NavigationExtras {
/** /**
* Sets query parameters to the URL. * Sets query parameters to the URL.
* *
* URL
*
* ``` * ```
* // Navigate to /results?page=1 * // Navigate to /results?page=1
* this.router.navigate(['/results'], { queryParams: { page: 1 } }); * this.router.navigate(['/results'], { queryParams: { page: 1 } });
@ -84,6 +92,8 @@ export interface NavigationExtras {
/** /**
* Sets the hash fragment for the URL. * Sets the hash fragment for the URL.
* *
* URL `#`
*
* ``` * ```
* // Navigate to /results#top * // Navigate to /results#top
* this.router.navigate(['/results'], { fragment: 'top' }); * this.router.navigate(['/results'], { fragment: 'top' });
@ -94,8 +104,12 @@ export interface NavigationExtras {
/** /**
* Preserves the query parameters for the next navigation. * Preserves the query parameters for the next navigation.
* *
* `?`
*
* deprecated, use `queryParamsHandling` instead * deprecated, use `queryParamsHandling` instead
* *
* `queryParamsHandling`
*
* ``` * ```
* // Preserve query params from /results?page=1 to /view?page=1 * // Preserve query params from /results?page=1 to /view?page=1
* this.router.navigate(['/view'], { preserveQueryParams: true }); * this.router.navigate(['/view'], { preserveQueryParams: true });
@ -108,6 +122,8 @@ export interface NavigationExtras {
/** /**
* config strategy to handle the query parameters for the next navigation. * config strategy to handle the query parameters for the next navigation.
* *
* `?`
*
* ``` * ```
* // from /results?page=1 to /view?page=1&page=2 * // from /results?page=1 to /view?page=1&page=2
* this.router.navigate(['/view'], { queryParams: { page: 2 }, queryParamsHandling: "merge" }); * this.router.navigate(['/view'], { queryParams: { page: 2 }, queryParamsHandling: "merge" });
@ -117,6 +133,8 @@ export interface NavigationExtras {
/** /**
* Preserves the fragment for the next navigation * Preserves the fragment for the next navigation
* *
* `#`
*
* ``` * ```
* // Preserve fragment from /results#top to /view#top * // Preserve fragment from /results#top to /view#top
* this.router.navigate(['/view'], { preserveFragment: true }); * this.router.navigate(['/view'], { preserveFragment: true });
@ -126,6 +144,8 @@ export interface NavigationExtras {
/** /**
* Navigates without pushing a new state into history. * Navigates without pushing a new state into history.
* *
*
*
* ``` * ```
* // Navigate silently to /view * // Navigate silently to /view
* this.router.navigate(['/view'], { skipLocationChange: true }); * this.router.navigate(['/view'], { skipLocationChange: true });
@ -135,6 +155,8 @@ export interface NavigationExtras {
/** /**
* Navigates while replacing the current state in history. * Navigates while replacing the current state in history.
* *
*
*
* ``` * ```
* // Navigate to /view * // Navigate to /view
* this.router.navigate(['/view'], { replaceUrl: true }); * this.router.navigate(['/view'], { replaceUrl: true });
@ -148,10 +170,14 @@ export interface NavigationExtras {
* *
* Error handler that is invoked when a navigation errors. * Error handler that is invoked when a navigation errors.
* *
*
*
* If the handler returns a value, the navigation promise will be resolved with this value. * If the handler returns a value, the navigation promise will be resolved with this value.
* If the handler throws an exception, the navigation promise will be rejected with * If the handler throws an exception, the navigation promise will be rejected with
* the exception. * the exception.
* *
* Promise 使resolve
* Promise 使reject
* *
*/ */
export type ErrorHandler = (error: any) => any; export type ErrorHandler = (error: any) => any;
@ -208,8 +234,12 @@ function defaultRouterHook(snapshot: RouterStateSnapshot, runExtras: {
* *
* Provides the navigation and url manipulation capabilities. * Provides the navigation and url manipulation capabilities.
* *
* URL
*
* See `Routes` for more details and examples. * See `Routes` for more details and examples.
* *
* `Routes`
*
* @ngModule RouterModule * @ngModule RouterModule
* *
* *
@ -231,7 +261,11 @@ export class Router {
/** /**
* Error handler that is invoked when a navigation errors. * Error handler that is invoked when a navigation errors.
* *
*
*
* See `ErrorHandler` for more information. * See `ErrorHandler` for more information.
*
* `ErrorHandler`
*/ */
errorHandler: ErrorHandler = defaultErrorHandler; errorHandler: ErrorHandler = defaultErrorHandler;
@ -239,6 +273,9 @@ export class Router {
* Malformed uri error handler is invoked when `Router.parseUrl(url)` throws an * Malformed uri error handler is invoked when `Router.parseUrl(url)` throws an
* error due to containing an invalid character. The most common case would be a `%` sign * error due to containing an invalid character. The most common case would be a `%` sign
* that's not encoded and is not part of a percent encoded sequence. * that's not encoded and is not part of a percent encoded sequence.
*
* uri `Router.parseUrl(url)` `url`
* `%` `%`
*/ */
malformedUriErrorHandler: malformedUriErrorHandler:
(error: URIError, urlSerializer: UrlSerializer, (error: URIError, urlSerializer: UrlSerializer,
@ -246,6 +283,8 @@ export class Router {
/** /**
* Indicates if at least one navigation happened. * Indicates if at least one navigation happened.
*
*
*/ */
navigated: boolean = false; navigated: boolean = false;
private lastSuccessfulId: number = -1; private lastSuccessfulId: number = -1;
@ -262,6 +301,8 @@ export class Router {
/** /**
* Extracts and merges URLs. Used for AngularJS to Angular migrations. * Extracts and merges URLs. Used for AngularJS to Angular migrations.
*
* URL AngularJS Angular
*/ */
urlHandlingStrategy: UrlHandlingStrategy = new DefaultUrlHandlingStrategy(); urlHandlingStrategy: UrlHandlingStrategy = new DefaultUrlHandlingStrategy();
@ -272,6 +313,10 @@ export class Router {
* By default, the router will ignore this navigation. However, this prevents features such * By default, the router will ignore this navigation. However, this prevents features such
* as a "refresh" button. Use this option to configure the behavior when navigating to the * as a "refresh" button. Use this option to configure the behavior when navigating to the
* current URL. Default is 'ignore'. * current URL. Default is 'ignore'.
*
* URL
* "刷新"
* 使 URL 'ignore'
*/ */
onSameUrlNavigation: 'reload'|'ignore' = 'ignore'; onSameUrlNavigation: 'reload'|'ignore' = 'ignore';
@ -279,9 +324,17 @@ export class Router {
* Defines how the router merges params, data and resolved data from parent to child * Defines how the router merges params, data and resolved data from parent to child
* routes. Available options are: * routes. Available options are:
* *
*
*
* - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less * - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less
* routes. * routes.
*
* `'emptyOnly'`
*
* - `'always'`, enables unconditional inheritance of parent params. * - `'always'`, enables unconditional inheritance of parent params.
*
* `'always'`
*
*/ */
paramsInheritanceStrategy: 'emptyOnly'|'always' = 'emptyOnly'; paramsInheritanceStrategy: 'emptyOnly'|'always' = 'emptyOnly';
@ -292,18 +345,31 @@ export class Router {
* URL early so if navigation fails, you can show an error message with the URL that failed. * URL early so if navigation fails, you can show an error message with the URL that failed.
* Available options are: * Available options are:
* *
* URL
* URL URL
*
*
* - `'deferred'`, the default, updates the browser URL after navigation has finished. * - `'deferred'`, the default, updates the browser URL after navigation has finished.
*
* `'deferred'` URL
*
* - `'eager'`, updates browser URL at the beginning of navigation. * - `'eager'`, updates browser URL at the beginning of navigation.
*
* `'eager'` URL
*/ */
urlUpdateStrategy: 'deferred'|'eager' = 'deferred'; urlUpdateStrategy: 'deferred'|'eager' = 'deferred';
/** /**
* See {@link RouterModule} for more information. * See {@link RouterModule} for more information.
*
* {@link RouterModule}
*/ */
relativeLinkResolution: 'legacy'|'corrected' = 'legacy'; relativeLinkResolution: 'legacy'|'corrected' = 'legacy';
/** /**
* Creates the router service. * Creates the router service.
*
*
*/ */
// TODO: vsavkin make internal after the final is out. // TODO: vsavkin make internal after the final is out.
constructor( constructor(
@ -337,6 +403,8 @@ export class Router {
/** /**
* Sets up the location change listener and performs the initial navigation. * Sets up the location change listener and performs the initial navigation.
*
*
*/ */
initialNavigation(): void { initialNavigation(): void {
this.setUpLocationChangeListener(); this.setUpLocationChangeListener();
@ -347,6 +415,8 @@ export class Router {
/** /**
* Sets up the location change listener. * Sets up the location change listener.
*
*
*/ */
setUpLocationChangeListener(): void { setUpLocationChangeListener(): void {
// Don't need to use Zone.wrap any more, because zone.js // Don't need to use Zone.wrap any more, because zone.js
@ -365,7 +435,10 @@ export class Router {
} }
} }
/** The current url */ /** The current url
*
* URL
*/
get url(): string { return this.serializeUrl(this.currentUrlTree); } get url(): string { return this.serializeUrl(this.currentUrlTree); }
/** @internal */ /** @internal */
@ -374,8 +447,12 @@ export class Router {
/** /**
* Resets the configuration used for navigation and generating links. * Resets the configuration used for navigation and generating links.
* *
* 使
*
* ### Usage * ### Usage
* *
* ###
*
* ``` * ```
* router.resetConfig([ * router.resetConfig([
* { path: 'team/:id', component: TeamCmp, children: [ * { path: 'team/:id', component: TeamCmp, children: [
@ -395,7 +472,10 @@ export class Router {
/** @docsNotRequired */ /** @docsNotRequired */
ngOnDestroy(): void { this.dispose(); } ngOnDestroy(): void { this.dispose(); }
/** Disposes of the router */ /** Disposes of the router
*
*
*/
dispose(): void { dispose(): void {
if (this.locationSubscription) { if (this.locationSubscription) {
this.locationSubscription.unsubscribe(); this.locationSubscription.unsubscribe();
@ -406,11 +486,18 @@ export class Router {
/** /**
* Applies an array of commands to the current url tree and creates a new url tree. * Applies an array of commands to the current url tree and creates a new url tree.
* *
* URL URL
*
* When given an activate route, applies the given commands starting from the route. * 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. * When not given a route, applies the given command starting from the root.
* *
*
*
*
* ### Usage * ### Usage
* *
* ###
*
* ``` * ```
* // create /team/33/user/11 * // create /team/33/user/11
* router.createUrlTree(['/team', 33, 'user', 11]); * router.createUrlTree(['/team', 33, 'user', 11]);
@ -476,13 +563,28 @@ export class Router {
/** /**
* Navigate based on the provided url. This navigation is always absolute. * Navigate based on the provided url. This navigation is always absolute.
* *
* url 使
*
* Returns a promise that: * Returns a promise that:
*
* Promise
*
* - resolves to 'true' when navigation succeeds, * - resolves to 'true' when navigation succeeds,
*
* `'true'`
*
* - resolves to 'false' when navigation fails, * - resolves to 'false' when navigation fails,
*
* `'false'`
*
* - is rejected when an error happens. * - is rejected when an error happens.
* *
* reject
*
* ### Usage * ### Usage
* *
* ###
*
* ``` * ```
* router.navigateByUrl("/team/33/user/11"); * router.navigateByUrl("/team/33/user/11");
* *
@ -492,6 +594,8 @@ export class Router {
* *
* In opposite to `navigate`, `navigateByUrl` takes a whole URL * In opposite to `navigate`, `navigateByUrl` takes a whole URL
* and does not apply any delta to the current one. * and does not apply any delta to the current one.
*
* `navigate` `navigateByUrl` URL URL
*/ */
navigateByUrl(url: string|UrlTree, extras: NavigationExtras = {skipLocationChange: false}): navigateByUrl(url: string|UrlTree, extras: NavigationExtras = {skipLocationChange: false}):
Promise<boolean> { Promise<boolean> {
@ -505,13 +609,29 @@ export class Router {
* Navigate based on the provided array of commands and a starting point. * Navigate based on the provided array of commands and a starting point.
* If no starting route is provided, the navigation is absolute. * If no starting route is provided, the navigation is absolute.
* *
*
*
*
* Returns a promise that: * Returns a promise that:
*
* Promise
*
* - resolves to 'true' when navigation succeeds, * - resolves to 'true' when navigation succeeds,
*
* `'true'`
*
* - resolves to 'false' when navigation fails, * - resolves to 'false' when navigation fails,
*
* `'false'`
*
* - is rejected when an error happens. * - is rejected when an error happens.
* *
* reject
*
* ### Usage * ### Usage
* *
* ###
*
* ``` * ```
* router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
* *
@ -528,10 +648,16 @@ export class Router {
return this.navigateByUrl(this.createUrlTree(commands, extras), extras); return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
} }
/** Serializes a `UrlTree` into a string */ /** Serializes a `UrlTree` into a string
*
* `UrlTree`
*/
serializeUrl(url: UrlTree): string { return this.urlSerializer.serialize(url); } serializeUrl(url: UrlTree): string { return this.urlSerializer.serialize(url); }
/** Parses a string into a `UrlTree` */ /** Parses a string into a `UrlTree`
*
* `UrlTree`
*/
parseUrl(url: string): UrlTree { parseUrl(url: string): UrlTree {
let urlTree: UrlTree; let urlTree: UrlTree;
try { try {
@ -542,7 +668,10 @@ export class Router {
return urlTree; return urlTree;
} }
/** Returns whether the url is activated */ /** Returns whether the url is activated
*
* `url`
*/
isActive(url: string|UrlTree, exact: boolean): boolean { isActive(url: string|UrlTree, exact: boolean): boolean {
if (url instanceof UrlTree) { if (url instanceof UrlTree) {
return containsTree(this.currentUrlTree, url, exact); return containsTree(this.currentUrlTree, url, exact);
@ -789,6 +918,8 @@ export class Router {
/** /**
* Performs the logic of activating routes. This is a synchronous process by default. While this * Performs the logic of activating routes. This is a synchronous process by default. While this
* is a private method, it could be overridden to make activation asynchronous. * is a private method, it could be overridden to make activation asynchronous.
*
*
*/ */
private activateRoutes( private activateRoutes(
state: Observable<false| state: Observable<false|