Move accountId retrieving into account module.
This commit is contained in:
@ -25,10 +25,27 @@ import {
|
||||
downgradeComponent
|
||||
} from '@angular/upgrade/static';
|
||||
|
||||
import uiRouter from '@uirouter/angularjs';
|
||||
|
||||
import { AccountService } from './account.service';
|
||||
import { AccountListComponent } from './accountList.component';
|
||||
|
||||
export default angular.module('accountant.accounts', [])
|
||||
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))
|
||||
|
||||
@ -36,4 +53,10 @@ export default angular.module('accountant.accounts', [])
|
||||
component: AccountListComponent
|
||||
}))
|
||||
|
||||
.run(function($transitions, accountIdService) {
|
||||
$transitions.onSuccess({}, (transition) => {
|
||||
accountIdService.set(transition.params().accountId);
|
||||
});
|
||||
})
|
||||
|
||||
.name;
|
||||
|
Reference in New Issue
Block a user