Skip to content

Commit

Permalink
Merge pull request #943 from IgniteUI/fix-issue-940
Browse files Browse the repository at this point in the history
Clear intervals and subscriptions when the component is destroyed
  • Loading branch information
zdrawku authored Feb 13, 2019
2 parents 8c45c6c + 6ffe4f9 commit 1940b88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/app/grid-finjs/grid-finjs-demo.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AfterViewInit, Component, ElementRef, NgZone, OnInit, QueryList, ViewChild } from "@angular/core";
import { AfterViewInit, Component, ElementRef, NgZone, OnDestroy, OnInit, QueryList, ViewChild } from "@angular/core";
import { DefaultSortingStrategy, IgxButtonGroupComponent, IgxColumnComponent,
IgxGridCellComponent, IgxGridComponent, IgxSliderComponent,
SortingDirection} from "igniteui-angular";
Expand Down Expand Up @@ -40,7 +40,7 @@ class Button {
styleUrls: ["./grid-finjs-demo.component.scss"],
templateUrl: "./grid-finjs-demo.component.html"
})
export class FinJSDemoComponent implements OnInit, AfterViewInit {
export class FinJSDemoComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild("grid1") public grid1: IgxGridComponent;
@ViewChild("buttonGroup1") public buttonGroup1: IgxButtonGroupComponent;
@ViewChild("slider1") public volumeSlider: IgxSliderComponent;
Expand Down Expand Up @@ -216,6 +216,10 @@ export class FinJSDemoComponent implements OnInit, AfterViewInit {
return this.elRef.nativeElement.parentElement.parentElement;
}

public ngOnDestroy() {
this.stopFeed();
}

public toggleToolbar(event: any) {
this.grid1.showToolbar = !this.grid1.showToolbar;
}
Expand Down
8 changes: 6 additions & 2 deletions src/app/treegrid-finjs/tree-grid-finjs-sample.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { AfterViewInit, Component, ElementRef, NgZone, ViewChild } from "@angular/core";
import { AfterViewInit, Component, ElementRef, NgZone, OnDestroy, ViewChild } from "@angular/core";
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy, HorizontalAlignment, IgxButtonGroupComponent,
IgxSliderComponent, IgxTreeGridComponent, OverlaySettings, PositionSettings,
VerticalAlignment} from "igniteui-angular";
Expand Down Expand Up @@ -42,7 +42,7 @@ export class Button {
templateUrl: "./tree-grid-finjs-sample.component.html"
})

export class TreeGridFinJSComponent implements AfterViewInit {
export class TreeGridFinJSComponent implements AfterViewInit, OnDestroy {
@ViewChild("grid1") public grid1: IgxTreeGridComponent;
@ViewChild("buttonGroup1") public buttonGroup1: IgxButtonGroupComponent;

Expand Down Expand Up @@ -177,6 +177,10 @@ export class TreeGridFinJSComponent implements AfterViewInit {
return this.elRef.nativeElement.parentElement.parentElement;
}

public ngOnDestroy() {
this.stopFeed();
}

public toggleToolbar(event: any) {
this.grid1.showToolbar = !this.grid1.showToolbar;
}
Expand Down

0 comments on commit 1940b88

Please sign in to comment.