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,24 +156,21 @@ module.exports = angular.module('balanceChartModule', [
{ value: 0, axis: 'y', class: 'zeroline'}, { value: 0, axis: 'y', class: 'zeroline'},
]); ]);
vm.chart.ygrids.add({ if(account) {
value: account.authorized_overdraft, vm.chart.ygrids.add({
axis: 'y', value: account.authorized_overdraft,
class: 'overdraft' axis: 'y',
}); 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) { } else {
vm.setLines(account); vm.setLines(vm.account);
return account;
});
} else {
vm.setLines(vm.account);
}
} }
}; };
} }