mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-09-22 05:50:48 +02:00
32 lines
841 B
TypeScript
32 lines
841 B
TypeScript
import { Component, OnDestroy } from '@angular/core';
|
|
import { NbThemeService } from '@nebular/theme';
|
|
|
|
import { ElectricityService } from '../../../@core/data/electricity.service';
|
|
|
|
@Component({
|
|
selector: 'ngx-electricity',
|
|
styleUrls: ['./electricity.component.scss'],
|
|
templateUrl: './electricity.component.html',
|
|
})
|
|
export class ElectricityComponent implements OnDestroy {
|
|
|
|
data: Array<any>;
|
|
|
|
type = 'week';
|
|
types = ['week', 'month', 'year'];
|
|
|
|
currentTheme: string;
|
|
themeSubscription: any;
|
|
|
|
constructor(private eService: ElectricityService, private themeService: NbThemeService) {
|
|
this.data = this.eService.getData();
|
|
|
|
this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => {
|
|
this.currentTheme = theme.name;
|
|
});
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.themeSubscription.unsubscribe();
|
|
}
|
|
}
|