// vim: set tw=80 ts=4 sw=4 sts=4: /* This file is part of Accountant. Accountant is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Accountant is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Accountant. If not, see . */ /* jshint node: true */ 'use strict'; var angular = require('angular'); //declare var angular: angular.IAngularStatic; import { downgradeInjectable, downgradeComponent } from '@angular/upgrade/static'; import uiRouter from '@uirouter/angularjs'; import { AccountService } from './account.service'; import { AccountListComponent } from './accountList.component'; import { DailyBalanceService } from './dailyBalance.service'; export default angular.module('accountant.accounts', [ uiRouter ]) .factory('accountIdService', function() { var accountId: null; return { get: () => { return accountId; }, set: (value) => { accountId = value; } } }) .factory('AccountService', downgradeInjectable(AccountService)) .factory('DailyBalanceService', downgradeInjectable(DailyBalanceService)) .directive('accountList', downgradeComponent({ component: AccountListComponent })) .run(function($transitions, accountIdService) { $transitions.onEnter({}, (transition) => { accountIdService.set(transition.params().accountId); }); }) .name;