diff --git a/src/accounts/index.ts b/src/accounts/index.ts index 29022cd..d1d67cb 100644 --- a/src/accounts/index.ts +++ b/src/accounts/index.ts @@ -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); }); }) diff --git a/src/operations/balance-chart.component.ts b/src/operations/balance-chart.component.ts index 4c79f5e..082480d 100644 --- a/src/operations/balance-chart.component.ts +++ b/src/operations/balance-chart.component.ts @@ -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']];