Move states in separate files.
This commit is contained in:
parent
7b7f72bf1e
commit
a7cee2891c
7
src/accounts/account.states.ts
Normal file
7
src/accounts/account.states.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// vim: set tw=80 ts=2 sw=2 sts=2 :
|
||||
|
||||
export const AccountListState = {
|
||||
name: 'accounts',
|
||||
url: '/accounts',
|
||||
component: 'accountList'
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
// vim: set tw=80 ts=2 sw=2 sts=2 :
|
||||
import { Level } from '@nsalaun/ng-logger';
|
||||
|
||||
var operationsTmpl = require('./operations/operations.html');
|
||||
import { AccountListState } from './accounts/account.states';
|
||||
import { OperationListState } from './operations/operation.states';
|
||||
import { ScheduleListState } from './scheduler/schedule.states';
|
||||
|
||||
export default function AppConfig($uiRouterProvider) {
|
||||
$uiRouterProvider.trace.enable(1);
|
||||
@ -9,33 +11,11 @@ export default function AppConfig($uiRouterProvider) {
|
||||
// Defining template and controller in function of route.
|
||||
const $stateRegistry = $uiRouterProvider.stateRegistry;
|
||||
|
||||
$stateRegistry.register({
|
||||
name: 'operations',
|
||||
url: '/account/:accountId/operations',
|
||||
templateUrl: operationsTmpl,
|
||||
controller: 'OperationController',
|
||||
controllerAs: 'operationsCtrl'
|
||||
});
|
||||
$stateRegistry.register(OperationListState);
|
||||
|
||||
$stateRegistry.register({
|
||||
name: 'scheduler',
|
||||
url: '/account/:accountId/scheduler',
|
||||
component: 'scheduleComponent',
|
||||
resolve: {
|
||||
accountId: function($transition$) {
|
||||
return $transition$.params().accountId;
|
||||
},
|
||||
$modal: function($modal) {
|
||||
return $modal;
|
||||
}
|
||||
}
|
||||
});
|
||||
$stateRegistry.register(ScheduleListState);
|
||||
|
||||
$stateRegistry.register({
|
||||
name: 'accounts',
|
||||
url: '/accounts',
|
||||
component: 'accountList',
|
||||
});
|
||||
$stateRegistry.register(AccountListState);
|
||||
|
||||
const $urlService = $uiRouterProvider.urlService;
|
||||
$urlService.rules.otherwise({
|
||||
|
11
src/operations/operation.states.ts
Normal file
11
src/operations/operation.states.ts
Normal file
@ -0,0 +1,11 @@
|
||||
// vim: set tw=80 ts=2 sw=2 sts=2 :
|
||||
|
||||
var operationsTmpl = require('./operations.html');
|
||||
|
||||
export const OperationListState = {
|
||||
name: 'operations',
|
||||
url: '/account/:accountId/operations',
|
||||
templateUrl: operationsTmpl,
|
||||
controller: 'OperationController',
|
||||
controllerAs: 'operationsCtrl'
|
||||
}
|
17
src/scheduler/schedule.states.ts
Normal file
17
src/scheduler/schedule.states.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// vim: set tw=80 ts=2 sw=2 sts=2 :
|
||||
|
||||
import { ScheduleComponent } from './schedule.component';
|
||||
|
||||
export const ScheduleListState = {
|
||||
name: 'scheduler',
|
||||
url: '/account/:accountId/scheduler',
|
||||
component: 'scheduleComponent',
|
||||
resolve: {
|
||||
accountId: function($transition$) {
|
||||
return $transition$.params().accountId;
|
||||
},
|
||||
$modal: function($modal) {
|
||||
return $modal;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user