Move up ng1 specific configuration in ng1 app module.

This commit is contained in:
Alexis Lahouze 2017-07-24 20:33:30 +02:00
parent 8fb5f2ff7a
commit 17a363d69d
2 changed files with 25 additions and 25 deletions

View File

@ -1,27 +1,5 @@
// vim: set tw=80 ts=2 sw=2 sts=2 :
import { Level } from '@nsalaun/ng-logger';
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);
// Defining template and controller in function of route.
const $stateRegistry = $uiRouterProvider.stateRegistry;
$stateRegistry.register(OperationListState);
$stateRegistry.register(ScheduleListState);
$stateRegistry.register(AccountListState);
const $urlService = $uiRouterProvider.urlService;
$urlService.rules.otherwise({
state: 'accounts'
});
};
export const ApiBaseURL = "http://localhost:8080/api";
export const LogLevel = Level.LOG;

View File

@ -22,13 +22,15 @@ var angular = require('angular');
import uiRouter from '@uirouter/angularjs';
import { AccountListState } from './accounts/account.states';
import { OperationListState } from './operations/operation.states';
import { ScheduleListState } from './scheduler/schedule.states';
import accountModule from '@accountant/accounts';
import loginModule from '@accountant/login';
import operationModule from '@accountant/operations';
import schedulerModule from '@accountant/scheduler';
import AppConfig from './app.config.ts';
require('bootstrap-webpack!./bootstrap.config.ts');
export const AppModule = angular.module('accountant', [
@ -37,4 +39,24 @@ export const AppModule = angular.module('accountant', [
loginModule,
operationModule,
schedulerModule,
]).config(AppConfig);
]);
AppModule.config(['$uiRouterProvider', ($uiRouterProvider) => {
$uiRouterProvider.trace.enable(1);
// Defining template and controller in function of route.
const $stateRegistry = $uiRouterProvider.stateRegistry;
$stateRegistry.register(OperationListState);
$stateRegistry.register(ScheduleListState);
$stateRegistry.register(AccountListState);
const $urlService = $uiRouterProvider.urlService;
$urlService.rules.otherwise({
state: 'accounts'
});
}]);
AppModule.run(['$trace', $trace => { $trace.enable(1); }]);