Skip to content

Commit

Permalink
refactor(angular): unused subscription in routerlink (#24950)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-perkins authored Mar 19, 2022
1 parent 0d07401 commit 63842a2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions angular/src/directives/navigation/router-link-delegate.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { LocationStrategy } from '@angular/common';
import { ElementRef, OnChanges, OnDestroy, OnInit, Directive, HostListener, Input, Optional } from '@angular/core';
import { ElementRef, OnChanges, OnInit, Directive, HostListener, Input, Optional } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
import { AnimationBuilder, RouterDirection } from '@ionic/core';
import { Subscription } from 'rxjs';

import { NavController } from '../../providers/nav-controller';

@Directive({
selector: '[routerLink]',
})
export class RouterLinkDelegateDirective implements OnInit, OnChanges, OnDestroy {
private subscription?: Subscription;

export class RouterLinkDelegateDirective implements OnInit, OnChanges {
@Input()
routerDirection: RouterDirection = 'forward';

Expand All @@ -34,12 +31,6 @@ export class RouterLinkDelegateDirective implements OnInit, OnChanges, OnDestroy
this.updateTargetUrlAndHref();
}

ngOnDestroy(): void {
if (this.subscription) {
this.subscription.unsubscribe();
}
}

private updateTargetUrlAndHref() {
if (this.routerLink?.urlTree) {
const href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.routerLink.urlTree));
Expand Down

0 comments on commit 63842a2

Please sign in to comment.