Fix account change handling in balance chart component.

This commit is contained in:
Alexis Lahouze 2017-07-14 10:33:20 +02:00
parent 5960e9ee77
commit 4861f5ce49

View File

@ -156,25 +156,22 @@ module.exports = angular.module('balanceChartModule', [
{ value: 0, axis: 'y', class: 'zeroline'}, { value: 0, axis: 'y', class: 'zeroline'},
]); ]);
if(account) {
vm.chart.ygrids.add({ vm.chart.ygrids.add({
value: account.authorized_overdraft, value: account.authorized_overdraft,
axis: 'y', axis: 'y',
class: 'overdraft' class: 'overdraft'
}); });
} }
}
}; };
vm.$onChanges = function(changes) { vm.$onChanges = function(changes) {
if('account' in changes) { if('account' in changes) {
if('$promise' in vm.account && vm.account.$resolved === false) { vm.setLines(changes.account.currentValue);
vm.account.$promise.then(function(account) {
vm.setLines(account);
return account;
});
} else { } else {
vm.setLines(vm.account); vm.setLines(vm.account);
} }
}
}; };
} }
}) })