diff --git a/src/operations/balanceChart.component.ts b/src/operations/balanceChart.component.ts index 4c1028f..cff6d46 100644 --- a/src/operations/balanceChart.component.ts +++ b/src/operations/balanceChart.component.ts @@ -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);