diff --git a/src/app/pages/charts/chartjs/chartjs-bar-horizontal.component.ts b/src/app/pages/charts/chartjs/chartjs-bar-horizontal.component.ts index bacf5d24..803c7519 100644 --- a/src/app/pages/charts/chartjs/chartjs-bar-horizontal.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-bar-horizontal.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class ChartjsBarHorizontalComponent { +export class ChartjsBarHorizontalComponent implements OnDestroy { data: any; options: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -74,6 +75,10 @@ export class ChartjsBarHorizontalComponent { }); } + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } + private random() { return Math.round(Math.random() * 100); } diff --git a/src/app/pages/charts/chartjs/chartjs-bar.component.ts b/src/app/pages/charts/chartjs/chartjs-bar.component.ts index 72dd5041..0fa95351 100644 --- a/src/app/pages/charts/chartjs/chartjs-bar.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-bar.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService, NbColorHelper } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService, NbColorHelper } from '@nebular/theme'; `, }) -export class ChartjsBarComponent { +export class ChartjsBarComponent implements OnDestroy { data: any; options: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -65,4 +66,8 @@ export class ChartjsBarComponent { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/chartjs/chartjs-line.component.ts b/src/app/pages/charts/chartjs/chartjs-line.component.ts index 35d55a30..b4cfcfe4 100644 --- a/src/app/pages/charts/chartjs/chartjs-line.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-line.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService, NbColorHelper } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService, NbColorHelper } from '@nebular/theme'; `, }) -export class ChartjsLineComponent { +export class ChartjsLineComponent implements OnDestroy { data: any; options: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -73,4 +74,8 @@ export class ChartjsLineComponent { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/chartjs/chartjs-multiple-xaxis.component.ts b/src/app/pages/charts/chartjs/chartjs-multiple-xaxis.component.ts index ef8fe9bb..ec2e4859 100644 --- a/src/app/pages/charts/chartjs/chartjs-multiple-xaxis.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-multiple-xaxis.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class ChartjsMultipleXaxisComponent { +export class ChartjsMultipleXaxisComponent implements OnDestroy { data: {}; options: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -106,6 +107,10 @@ export class ChartjsMultipleXaxisComponent { }); } + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } + private random() { return Math.round(Math.random() * 100); } diff --git a/src/app/pages/charts/chartjs/chartjs-pie.component.ts b/src/app/pages/charts/chartjs/chartjs-pie.component.ts index 9c8ac1b1..a96e2ee0 100644 --- a/src/app/pages/charts/chartjs/chartjs-pie.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-pie.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class ChartjsPieComponent { +export class ChartjsPieComponent implements OnDestroy { data: any; options: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -54,4 +55,8 @@ export class ChartjsPieComponent { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/chartjs/chartjs-radar.component.ts b/src/app/pages/charts/chartjs/chartjs-radar.component.ts index c77dfd68..20b7257d 100644 --- a/src/app/pages/charts/chartjs/chartjs-radar.component.ts +++ b/src/app/pages/charts/chartjs/chartjs-radar.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService, NbColorHelper } from '@nebular/theme'; @Component({ @@ -7,12 +7,13 @@ import { NbThemeService, NbColorHelper } from '@nebular/theme'; `, }) -export class ChartjsRadarComponent { +export class ChartjsRadarComponent implements OnDestroy { options: any; data: {}; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const chartjs: any = config.variables.chartjs; @@ -56,4 +57,8 @@ export class ChartjsRadarComponent { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-advanced-pie.component.ts b/src/app/pages/charts/d3/d3-advanced-pie.component.ts index 6f6fdfb8..21d44e97 100644 --- a/src/app/pages/charts/d3/d3-advanced-pie.component.ts +++ b/src/app/pages/charts/d3/d3-advanced-pie.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -10,7 +10,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3AdvancedPieComponent { +export class D3AdvancedPieComponent implements OnDestroy { single = [ { name: 'Germany', @@ -26,13 +26,18 @@ export class D3AdvancedPieComponent { }, ]; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-area-stack.component.ts b/src/app/pages/charts/d3/d3-area-stack.component.ts index fb866f4f..367fccba 100644 --- a/src/app/pages/charts/d3/d3-area-stack.component.ts +++ b/src/app/pages/charts/d3/d3-area-stack.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -18,7 +18,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3AreaStackComponent { +export class D3AreaStackComponent implements OnDestroy { multi = [{ name: 'Germany', series: [{ @@ -56,13 +56,18 @@ export class D3AreaStackComponent { xAxisLabel = 'Country'; yAxisLabel = 'Population'; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-bar.component.ts b/src/app/pages/charts/d3/d3-bar.component.ts index 7ac30636..19357589 100644 --- a/src/app/pages/charts/d3/d3-bar.component.ts +++ b/src/app/pages/charts/d3/d3-bar.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -15,7 +15,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3BarComponent { +export class D3BarComponent implements OnDestroy { results = [ { name: 'Germany', value: 8940 }, @@ -28,13 +28,18 @@ export class D3BarComponent { xAxisLabel = 'Country'; yAxisLabel = 'Population'; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-line.component.ts b/src/app/pages/charts/d3/d3-line.component.ts index 2abb066e..f1d4b4eb 100644 --- a/src/app/pages/charts/d3/d3-line.component.ts +++ b/src/app/pages/charts/d3/d3-line.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -17,7 +17,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3LineComponent { +export class D3LineComponent implements OnDestroy { multi = [ { name: 'Germany', @@ -67,13 +67,18 @@ export class D3LineComponent { showYAxisLabel = true; yAxisLabel = 'Population'; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-pie.component.ts b/src/app/pages/charts/d3/d3-pie.component.ts index 82a75e31..39faf8cf 100644 --- a/src/app/pages/charts/d3/d3-pie.component.ts +++ b/src/app/pages/charts/d3/d3-pie.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -12,7 +12,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3PieComponent { +export class D3PieComponent implements OnDestroy { results = [ { name: 'Germany', value: 8940 }, { name: 'USA', value: 5000 }, @@ -21,13 +21,18 @@ export class D3PieComponent { showLegend = true; showLabels = true; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/d3/d3-polar.component.ts b/src/app/pages/charts/d3/d3-polar.component.ts index 4778b8e1..e7fe3c9d 100644 --- a/src/app/pages/charts/d3/d3-polar.component.ts +++ b/src/app/pages/charts/d3/d3-polar.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -18,7 +18,7 @@ import { NbThemeService } from '@nebular/theme'; `, }) -export class D3PolarComponent { +export class D3PolarComponent implements OnDestroy { multi = [ { name: 'Germany', @@ -81,13 +81,18 @@ export class D3PolarComponent { xAxisLabel = 'Country'; yAxisLabel = 'Population'; colorScheme: any; + themeSubscription: any; constructor(private theme: NbThemeService) { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-area-stack.component.ts b/src/app/pages/charts/echarts/echarts-area-stack.component.ts index 4764b409..a9e0e4c1 100644 --- a/src/app/pages/charts/echarts/echarts-area-stack.component.ts +++ b/src/app/pages/charts/echarts/echarts-area-stack.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsAreaStackComponent implements AfterViewInit { +export class EchartsAreaStackComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const echarts: any = config.variables.echarts; @@ -132,4 +133,8 @@ export class EchartsAreaStackComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-bar-animation.component.ts b/src/app/pages/charts/echarts/echarts-bar-animation.component.ts index 75db9713..ad88abf7 100644 --- a/src/app/pages/charts/echarts/echarts-bar-animation.component.ts +++ b/src/app/pages/charts/echarts/echarts-bar-animation.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsBarAnimationComponent implements AfterViewInit { +export class EchartsBarAnimationComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const xAxisData = []; const data1 = []; const data2 = []; @@ -101,4 +102,8 @@ export class EchartsBarAnimationComponent implements AfterViewInit { } }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-bar.component.ts b/src/app/pages/charts/echarts/echarts-bar.component.ts index dcaffd8a..db753b2f 100644 --- a/src/app/pages/charts/echarts/echarts-bar.component.ts +++ b/src/app/pages/charts/echarts/echarts-bar.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsBarComponent implements AfterViewInit { +export class EchartsBarComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const echarts: any = config.variables.echarts; @@ -84,4 +85,8 @@ export class EchartsBarComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-line.component.ts b/src/app/pages/charts/echarts/echarts-line.component.ts index a412f3cb..7be38d5d 100644 --- a/src/app/pages/charts/echarts/echarts-line.component.ts +++ b/src/app/pages/charts/echarts/echarts-line.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsLineComponent implements AfterViewInit { +export class EchartsLineComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const echarts: any = config.variables.echarts; @@ -98,4 +99,8 @@ export class EchartsLineComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-multiple-xaxis.component.ts b/src/app/pages/charts/echarts/echarts-multiple-xaxis.component.ts index d1dcf771..5daefeae 100644 --- a/src/app/pages/charts/echarts/echarts-multiple-xaxis.component.ts +++ b/src/app/pages/charts/echarts/echarts-multiple-xaxis.component.ts @@ -1,4 +1,4 @@ -import { Component, AfterViewInit } from '@angular/core'; +import { Component, AfterViewInit, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsMultipleXaxisComponent implements AfterViewInit { +export class EchartsMultipleXaxisComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const echarts: any = config.variables.echarts; @@ -158,4 +159,8 @@ export class EchartsMultipleXaxisComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-pie.component.ts b/src/app/pages/charts/echarts/echarts-pie.component.ts index fb9620fd..9373d30c 100644 --- a/src/app/pages/charts/echarts/echarts-pie.component.ts +++ b/src/app/pages/charts/echarts/echarts-pie.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsPieComponent implements AfterViewInit { +export class EchartsPieComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors = config.variables; const echarts: any = config.variables.echarts; @@ -73,4 +74,8 @@ export class EchartsPieComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } } diff --git a/src/app/pages/charts/echarts/echarts-radar.component.ts b/src/app/pages/charts/echarts/echarts-radar.component.ts index 07a13322..6b3229ac 100644 --- a/src/app/pages/charts/echarts/echarts-radar.component.ts +++ b/src/app/pages/charts/echarts/echarts-radar.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component } from '@angular/core'; +import { AfterViewInit, Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ @@ -7,14 +7,15 @@ import { NbThemeService } from '@nebular/theme';
`, }) -export class EchartsRadarComponent implements AfterViewInit { +export class EchartsRadarComponent implements AfterViewInit, OnDestroy { options: any = {}; + themeSubscription: any; constructor(private theme: NbThemeService) { } ngAfterViewInit() { - this.theme.getJsTheme().subscribe(config => { + this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; const echarts: any = config.variables.echarts; @@ -68,4 +69,8 @@ export class EchartsRadarComponent implements AfterViewInit { }; }); } + + ngOnDestroy(): void { + this.themeSubscription.unsubscribe(); + } }