ngx-admin/src/app/pages/dashboard/electricity/electricity.component.ts

33 lines
844 B
TypeScript
Raw Normal View History

import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
2017-07-14 18:55:38 +03:00
import { ElectricityService } from '../../../@core/data/electricity.service';
2017-07-11 18:59:08 +03:00
@Component({
selector: 'ngx-electricity',
styleUrls: ['./electricity.component.scss'],
templateUrl: './electricity.component.html',
})
export class ElectricityComponent implements OnDestroy {
2017-07-11 18:59:08 +03:00
2017-07-14 18:55:38 +03:00
data: Array<any>;
type: string = 'week';
types = ['week', 'month', 'year'];
currentTheme: string;
themeSubscription: any;
constructor(private eService: ElectricityService, private themeService: NbThemeService) {
this.data = eService.getData();
this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => {
this.currentTheme = theme.name;
});
2017-07-14 18:55:38 +03:00
}
ngOnDestroy() {
this.themeSubscription.unsubscribe();
}
2017-07-11 18:59:08 +03:00
}