diff --git a/src/scheduler/index.ts b/src/scheduler/index.ts index e1b6835..07bc9f9 100644 --- a/src/scheduler/index.ts +++ b/src/scheduler/index.ts @@ -30,6 +30,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrService } from 'ngx-toastr'; var ngStrap = require('angular-strap'); +import uiRouter from '@uirouter/angularjs'; var schedulerTmpl = require('./scheduler.html'); @@ -37,6 +38,7 @@ import { ScheduleComponent } from './schedule.component'; import { ScheduleService } from './schedule.service'; export default angular.module('accountant.scheduler', [ + uiRouter, ngStrap ]) .factory('toastrService', downgradeInjectable(ToastrService)) @@ -45,6 +47,19 @@ export default angular.module('accountant.scheduler', [ .factory('logger', downgradeInjectable(Logger)) + .factory('accountIdService', function() { + var accountId: null; + + return { + get: () => { + return accountId; + }, + set: (value) => { + accountId = value; + } + } + }) + .factory('scheduleService', downgradeInjectable(ScheduleService)) .component('scheduleComponent', { @@ -57,4 +72,10 @@ export default angular.module('accountant.scheduler', [ controllerAs: 'schedulerCtrl' }) + .run(function($transitions, accountIdService) { + $transitions.onSuccess({}, (transition) => { + accountIdService.set(transition.params().accountId); + }); + }) + .name;