fix(angular): routerLink with null value works with Angular 13 (#24622)

Resolves #24586
This commit is contained in:
Sean Perkins
2022-01-24 16:07:27 -05:00
committed by GitHub
parent fde35a361f
commit 90a9a9c3e8
2 changed files with 11 additions and 5 deletions

View File

@ -41,7 +41,7 @@ export class RouterLinkDelegateDirective implements OnInit, OnChanges, OnDestroy
}
private updateTargetUrlAndHref() {
if (this.routerLink) {
if (this.routerLink?.urlTree) {
const href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.routerLink.urlTree));
this.elementRef.nativeElement.href = href;
}