(
button: number,
ctrlKey: boolean,
shiftKey: boolean,
altKey: boolean,
metaKey: boolean,
)
| 477 | '$event.metaKey', |
| 478 | ]) |
| 479 | onClick( |
| 480 | button: number, |
| 481 | ctrlKey: boolean, |
| 482 | shiftKey: boolean, |
| 483 | altKey: boolean, |
| 484 | metaKey: boolean, |
| 485 | ): boolean { |
| 486 | const urlTree = this._urlTree(); |
| 487 | |
| 488 | if (urlTree === null) { |
| 489 | return true; |
| 490 | } |
| 491 | |
| 492 | if (this.isAnchorElement) { |
| 493 | if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) { |
| 494 | return true; |
| 495 | } |
| 496 | |
| 497 | if (typeof this.target === 'string' && this.target != '_self') { |
| 498 | return true; |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | const browserUrl = this.browserUrl(); |
| 503 | const extras = { |
| 504 | skipLocationChange: this.skipLocationChange, |
| 505 | replaceUrl: this.replaceUrl, |
| 506 | state: this.state, |
| 507 | info: this.info, |
| 508 | // TODO: Remove conditional spread once all consumers handle `browserUrl`. |
| 509 | // Having this property always set broke some tests in G3. |
| 510 | ...(browserUrl !== undefined && {browserUrl}), |
| 511 | }; |
| 512 | // navigateByUrl is mocked frequently in tests... Reduce breakages when |
| 513 | // adding `catch` |
| 514 | this.router.navigateByUrl(urlTree, extras)?.catch((e) => { |
| 515 | this.applicationErrorHandler(e); |
| 516 | }); |
| 517 | |
| 518 | // Return `false` for `<a>` elements to prevent default action |
| 519 | // and cancel the native behavior, since the navigation is handled |
| 520 | // by the Router. |
| 521 | return !this.isAnchorElement; |
| 522 | } |
| 523 | |
| 524 | /** @docs-private */ |
| 525 | ngOnDestroy(): any {} |
nothing calls this directly
no test coverage detected