Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit 1cec427

Browse files
committed
fix: add onDestroy to router link example
1 parent cde75d6 commit 1cec427

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

demo/src/app/advanced/router-link.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AfterViewInit, Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
1+
import { AfterViewInit, Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { ADTSettings } from 'angular-datatables/src/models/settings';
44
import { Subject } from 'rxjs';
@@ -9,7 +9,7 @@ import { DemoNgComponent } from './demo-ng-template-ref.component';
99
selector: 'app-router-link',
1010
templateUrl: 'router-link.component.html'
1111
})
12-
export class RouterLinkComponent implements AfterViewInit, OnInit {
12+
export class RouterLinkComponent implements AfterViewInit, OnInit, OnDestroy {
1313

1414
pageTitle = 'Router Link';
1515
mdIntro = 'assets/docs/advanced/router-link/intro.md';
@@ -70,4 +70,8 @@ export class RouterLinkComponent implements AfterViewInit, OnInit {
7070
onCaptureEvent(event: IDemoNgComponentEventType) {
7171
this.router.navigate(["/person/" + event.data.id]);
7272
}
73+
74+
ngOnDestroy(): void {
75+
this.dtTrigger?.unsubscribe();
76+
}
7377
}

0 commit comments

Comments
 (0)