Change @Input handling.
This commit is contained in:
parent
8eaa3b9039
commit
8b63a9d5df
@ -2,11 +2,7 @@
|
|||||||
|
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
import {
|
import { Component, ViewChild, Input, OnInit } from '@angular/core';
|
||||||
Component, ViewChild,
|
|
||||||
Inject, Input, Output, EventEmitter,
|
|
||||||
OnInit, OnChanges
|
|
||||||
} from '@angular/core';
|
|
||||||
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
|
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
|
||||||
|
|
||||||
import { Logger } from '@nsalaun/ng-logger';
|
import { Logger } from '@nsalaun/ng-logger';
|
||||||
@ -32,8 +28,8 @@ import { DailyBalanceService } from '../accounts/dailyBalance.service';
|
|||||||
</jqxChart>
|
</jqxChart>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class BalanceChartComponent implements OnInit, OnChanges {
|
export class BalanceChartComponent implements OnInit {
|
||||||
@Input() account: Account;
|
private _account: Account;
|
||||||
@ViewChild('balanceChart') chart: jqxChartComponent;
|
@ViewChild('balanceChart') chart: jqxChartComponent;
|
||||||
|
|
||||||
public data;
|
public data;
|
||||||
@ -168,10 +164,15 @@ export class BalanceChartComponent implements OnInit, OnChanges {
|
|||||||
this.loadData();
|
this.loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes) {
|
@Input()
|
||||||
if('account' in changes && changes.account.currentValue) {
|
set account(account: Account) {
|
||||||
this.setLines(changes.account.currentValue);
|
this._account = account;
|
||||||
}
|
|
||||||
|
this.setLines(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
get account(): Account {
|
||||||
|
return this._account;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateXBands(minDate, maxDate) {
|
updateXBands(minDate, maxDate) {
|
||||||
|
Loading…
Reference in New Issue
Block a user