/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { LocationStrategy } from '@angular/common'; import { Attribute, booleanAttribute, Directive, ElementRef, HostBinding, HostListener, Input, Renderer2, ɵɵsanitizeUrlOrResourceUrl } from '@angular/core'; import { Subject } from 'rxjs'; import { NavigationEnd } from '../events'; import { Router } from '../router'; import { ActivatedRoute } from '../router_state'; import * as i0 from "@angular/core"; import * as i1 from "../router"; import * as i2 from "../router_state"; import * as i3 from "@angular/common"; /** * @description * * When applied to an element in a template, makes that element a link * that initiates navigation to a route. Navigation opens one or more routed components * in one or more `` locations on the page. * * Given a route configuration `[{ path: 'user/:name', component: UserCmp }]`, * the following creates a static link to the route: * `link to user component` * * You can use dynamic values to generate the link. * For a dynamic link, pass an array of path segments, * followed by the params for each segment. * For example, `['/team', teamId, 'user', userName, {details: true}]` * generates a link to `/team/11/user/bob;details=true`. * * Multiple static segments can be merged into one term and combined with dynamic segments. * For example, `['/team/11/user', userName, {details: true}]` * * The input that you provide to the link is treated as a delta to the current URL. * For instance, suppose the current URL is `/user/(box//aux:team)`. * The link `Jim` creates the URL * `/user/(jim//aux:team)`. * See {@link Router#createUrlTree} for more information. * * @usageNotes * * You can use absolute or relative paths in a link, set query parameters, * control how parameters are handled, and keep a history of navigation states. * * ### Relative link paths * * The first segment name can be prepended with `/`, `./`, or `../`. * * If the first segment begins with `/`, the router looks up the route from the root of the * app. * * If the first segment begins with `./`, or doesn't begin with a slash, the router * looks in the children of the current activated route. * * If the first segment begins with `../`, the router goes up one level in the route tree. * * ### Setting and handling query params and fragments * * The following link adds a query parameter and a fragment to the generated URL: * * ``` * * link to user component * * ``` * By default, the directive constructs the new URL using the given query parameters. * The example generates the link: `/user/bob?debug=true#education`. * * You can instruct the directive to handle query parameters differently * by specifying the `queryParamsHandling` option in the link. * Allowed values are: * * - `'merge'`: Merge the given `queryParams` into the current query params. * - `'preserve'`: Preserve the current query params. * * For example: * * ``` * * link to user component * * ``` * * See {@link UrlCreationOptions#queryParamsHandling}. * * ### Preserving navigation history * * You can provide a `state` value to be persisted to the browser's * [`History.state` property](https://developer.mozilla.org/en-US/docs/Web/API/History#Properties). * For example: * * ``` * * link to user component * * ``` * * Use {@link Router#getCurrentNavigation} to retrieve a saved * navigation-state value. For example, to capture the `tracingId` during the `NavigationStart` * event: * * ``` * // Get NavigationStart events * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => { * const navigation = router.getCurrentNavigation(); * tracingService.trace({id: navigation.extras.state.tracingId}); * }); * ``` * * @ngModule RouterModule * * @publicApi */ export class RouterLink { constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) { this.router = router; this.route = route; this.tabIndexAttribute = tabIndexAttribute; this.renderer = renderer; this.el = el; this.locationStrategy = locationStrategy; /** * Represents an `href` attribute value applied to a host element, * when a host element is ``. For other tags, the value is `null`. */ this.href = null; this.commands = null; /** @internal */ this.onChanges = new Subject(); /** * Passed to {@link Router#createUrlTree} as part of the * `UrlCreationOptions`. * @see {@link UrlCreationOptions#preserveFragment} * @see {@link Router#createUrlTree} */ this.preserveFragment = false; /** * Passed to {@link Router#navigateByUrl} as part of the * `NavigationBehaviorOptions`. * @see {@link NavigationBehaviorOptions#skipLocationChange} * @see {@link Router#navigateByUrl} */ this.skipLocationChange = false; /** * Passed to {@link Router#navigateByUrl} as part of the * `NavigationBehaviorOptions`. * @see {@link NavigationBehaviorOptions#replaceUrl} * @see {@link Router#navigateByUrl} */ this.replaceUrl = false; const tagName = el.nativeElement.tagName?.toLowerCase(); this.isAnchorElement = tagName === 'a' || tagName === 'area'; if (this.isAnchorElement) { this.subscription = router.events.subscribe((s) => { if (s instanceof NavigationEnd) { this.updateHref(); } }); } else { this.setTabIndexIfNotOnNativeEl('0'); } } /** * Modifies the tab index if there was not a tabindex attribute on the element during * instantiation. */ setTabIndexIfNotOnNativeEl(newTabIndex) { if (this.tabIndexAttribute != null /* both `null` and `undefined` */ || this.isAnchorElement) { return; } this.applyAttributeValue('tabindex', newTabIndex); } /** @nodoc */ ngOnChanges(changes) { if (this.isAnchorElement) { this.updateHref(); } // This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes // to the RouterLinks it's tracking. this.onChanges.next(this); } /** * Commands to pass to {@link Router#createUrlTree}. * - **array**: commands to pass to {@link Router#createUrlTree}. * - **string**: shorthand for array of commands with just the string, i.e. `['/route']` * - **null|undefined**: effectively disables the `routerLink` * @see {@link Router#createUrlTree} */ set routerLink(commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; this.setTabIndexIfNotOnNativeEl('0'); } else { this.commands = null; this.setTabIndexIfNotOnNativeEl(null); } } /** @nodoc */ onClick(button, ctrlKey, shiftKey, altKey, metaKey) { if (this.urlTree === null) { return true; } if (this.isAnchorElement) { if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) { return true; } if (typeof this.target === 'string' && this.target != '_self') { return true; } } const extras = { skipLocationChange: this.skipLocationChange, replaceUrl: this.replaceUrl, state: this.state, }; this.router.navigateByUrl(this.urlTree, extras); // Return `false` for `` elements to prevent default action // and cancel the native behavior, since the navigation is handled // by the Router. return !this.isAnchorElement; } /** @nodoc */ ngOnDestroy() { this.subscription?.unsubscribe(); } updateHref() { this.href = this.urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(this.urlTree)) : null; const sanitizedValue = this.href === null ? null : // This class represents a directive that can be added to both `` elements, // as well as other elements. As a result, we can't define security context at // compile time. So the security context is deferred to runtime. // The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function // based on the tag and property names. The logic mimics the one from // `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time. // // Note: we should investigate whether we can switch to using `@HostBinding('attr.href')` // instead of applying a value via a renderer, after a final merge of the // `RouterLinkWithHref` directive. ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href'); this.applyAttributeValue('href', sanitizedValue); } applyAttributeValue(attrName, attrValue) { const renderer = this.renderer; const nativeElement = this.el.nativeElement; if (attrValue !== null) { renderer.setAttribute(nativeElement, attrName, attrValue); } else { renderer.removeAttribute(nativeElement, attrName); } } get urlTree() { if (this.commands === null) { return null; } return this.router.createUrlTree(this.commands, { // If the `relativeTo` input is not defined, we want to use `this.route` by default. // Otherwise, we should use the value provided by the user in the input. relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route, queryParams: this.queryParams, fragment: this.fragment, queryParamsHandling: this.queryParamsHandling, preserveFragment: this.preserveFragment, }); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLink, deps: [{ token: i1.Router }, { token: i2.ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "16.2.12", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLink, decorators: [{ type: Directive, args: [{ selector: '[routerLink]', standalone: true, }] }], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.ActivatedRoute }, { type: undefined, decorators: [{ type: Attribute, args: ['tabindex'] }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{ type: HostBinding, args: ['attr.target'] }, { type: Input }], queryParams: [{ type: Input }], fragment: [{ type: Input }], queryParamsHandling: [{ type: Input }], state: [{ type: Input }], relativeTo: [{ type: Input }], preserveFragment: [{ type: Input, args: [{ transform: booleanAttribute }] }], skipLocationChange: [{ type: Input, args: [{ transform: booleanAttribute }] }], replaceUrl: [{ type: Input, args: [{ transform: booleanAttribute }] }], routerLink: [{ type: Input }], onClick: [{ type: HostListener, args: ['click', ['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey']] }] } }); /** * @description * An alias for the `RouterLink` directive. * Deprecated since v15, use `RouterLink` directive instead. * * @deprecated use `RouterLink` directive instead. * @publicApi */ export { RouterLink as RouterLinkWithHref }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX2xpbmsuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9yb3V0ZXIvc3JjL2RpcmVjdGl2ZXMvcm91dGVyX2xpbmsudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDakQsT0FBTyxFQUFDLFNBQVMsRUFBRSxnQkFBZ0IsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLFdBQVcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUF3QixTQUFTLEVBQWlCLDBCQUEwQixFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQy9MLE9BQU8sRUFBQyxPQUFPLEVBQWUsTUFBTSxNQUFNLENBQUM7QUFFM0MsT0FBTyxFQUFRLGFBQWEsRUFBQyxNQUFNLFdBQVcsQ0FBQztBQUUvQyxPQUFPLEVBQUMsTUFBTSxFQUFDLE1BQU0sV0FBVyxDQUFD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