From 17a363d69da2b6aeaa29e207f1e02e8e5af7b33d Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Mon, 24 Jul 2017 20:33:30 +0200 Subject: [PATCH] Move up ng1 specific configuration in ng1 app module. --- src/app.config.ts | 22 ---------------------- src/app.ts | 28 +++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/app.config.ts b/src/app.config.ts index b0d3f3d..482e7b4 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -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; diff --git a/src/app.ts b/src/app.ts index f3bdb5e..2e003e7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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); }]);