created change listener for current date on analysis page
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<ion-modal [keepContentsMounted]="true">
|
<ion-modal [keepContentsMounted]="true">
|
||||||
<ng-template>
|
<ng-template>
|
||||||
<ion-datetime id="current-datetime" presentation="date" [(ngModel)]="currentDate" (ionChange)="updateCurrentData()"></ion-datetime>
|
<ion-datetime id="current-datetime" presentation="date" [(ngModel)]="currentDate"></ion-datetime>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ion-modal>
|
</ion-modal>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -49,12 +49,26 @@ export class AnalysisPage {
|
|||||||
@ViewChild('chart') chartRef: ElementRef;
|
@ViewChild('chart') chartRef: ElementRef;
|
||||||
private chart: any;
|
private chart: any;
|
||||||
|
|
||||||
|
private changeListener: any;
|
||||||
|
|
||||||
constructor(private time: TimeService) {
|
constructor(private time: TimeService) {
|
||||||
addIcons({briefcase, pizza, card})
|
addIcons({briefcase, pizza, card})
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidEnter() {
|
ionViewDidEnter() {
|
||||||
this.updateCurrentData();
|
this.updateCurrentData();
|
||||||
|
|
||||||
|
let lastDate: any = undefined;
|
||||||
|
this.changeListener = setInterval(() => {
|
||||||
|
if (this.currentDate != lastDate) {
|
||||||
|
lastDate = this.currentDate;
|
||||||
|
this.updateCurrentData();
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
ionViewDidLeave() {
|
||||||
|
clearInterval(this.changeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCurrentData() {
|
public updateCurrentData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user