Add accountIdService to be able to correctly retrieve accountId in UiRouter transition.
This commit is contained in:
parent
ad16b5a391
commit
fa9402e25e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user