Use account directly to load daily balances.

This commit is contained in:
Alexis Lahouze 2017-07-29 16:28:59 +02:00
parent 7281d1f11d
commit fa147e74fc

View File

@ -35,9 +35,9 @@ export class BalanceChartComponent implements OnInit, OnChanges {
) {
}
loadData() {
loadData(account: Account) {
this.dailyBalanceService.query(
this.accountIdService.get()
account.id
).subscribe((results) => {
var headers: any[][] = [['date', 'balances', 'expenses', 'revenues']];
@ -148,8 +148,6 @@ export class BalanceChartComponent implements OnInit, OnChanges {
}
}
});
this.loadData();
};
setLines(account: Account) {
@ -170,7 +168,8 @@ export class BalanceChartComponent implements OnInit, OnChanges {
};
ngOnChanges(changes) {
if('account' in changes) {
if('account' in changes && changes.account.currentValue) {
this.loadData(changes.account.currentValue);
this.setLines(changes.account.currentValue);
} else {
this.setLines(this.account);