Use accountIdService to retrieve current Account Id.

This commit is contained in:
Alexis Lahouze 2017-07-27 00:41:07 +02:00
parent 2d50ad8a0b
commit c0b236ff6c
2 changed files with 7 additions and 4 deletions

View File

@ -54,7 +54,7 @@ export default angular.module('accountant.accounts', [
}))
.run(function($transitions, accountIdService) {
$transitions.onSuccess({}, (transition) => {
$transitions.onEnter({}, (transition) => {
accountIdService.set(transition.params().accountId);
});
})

View File

@ -25,8 +25,11 @@ var angular = require('angular');
var ngResource = require('angular-resource');
import accountModule from '@accountant/accounts';
module.exports = angular.module('balanceChartModule', [
ngResource
ngResource,
accountModule
])
.component('balanceChart', {
@ -35,12 +38,12 @@ module.exports = angular.module('balanceChartModule', [
account: '<',
onUpdate: '&'
},
controller: function($stateParams, Balances, $element) {
controller: function(accountIdService, Balances, $element) {
var vm = this;
vm.loadData = function() {
Balances.query({
id: $stateParams.accountId
id: accountIdService.get()
}, function(results) {
var headers = [['date', 'balances', 'expenses', 'revenues']];