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'},
]);
if(account) {
vm.chart.ygrids.add({
value: account.authorized_overdraft,
axis: 'y',
class: 'overdraft'
});
}
}
};
vm.$onChanges = function(changes) {
if('account' in changes) {
if('$promise' in vm.account && vm.account.$resolved === false) {
vm.account.$promise.then(function(account) {
vm.setLines(account);
return account;
});
vm.setLines(changes.account.currentValue);
} else {
vm.setLines(vm.account);
}
}
};
}
})