Separate app.config in another file.

This commit is contained in:
Alexis Lahouze 2017-07-07 22:31:49 +02:00
parent 2fb98fdeed
commit fbeb3fd362
2 changed files with 26 additions and 27 deletions

22
src/app.config.js Normal file
View File

@ -0,0 +1,22 @@
module.exports = function($routeProvider) {
// Defining template and controller in function of route.
$routeProvider
.when('/account/:accountId/operations', {
templateUrl: operationsTmpl,
controller: 'OperationController',
controllerAs: 'operationsCtrl'
})
.when('/account/:accountId/scheduler', {
templateUrl: schedulerTmpl,
controller: 'SchedulerController',
controllerAs: 'schedulerCtrl'
})
.when('/accounts', {
templateUrl: accountsTmpl,
controller: 'AccountController',
controllerAs: 'accountsCtrl'
})
.otherwise({
redirectTo: '/accounts'
});
};

View File

@ -27,41 +27,18 @@ var accountModule = require('./accounts'),
operationModule = require('./operations'),
schedulerModule = require('./scheduler');
var routing = require('./app.config');
require('bootstrap-webpack!./bootstrap.config.js');
var operationsTmpl = require('./operations/operations.html');
var accountsTmpl = require('./accounts/accounts.html');
var schedulerTmpl = require('./scheduler/scheduler.html');
var app = angular.module('accountant', [
angular.module('accountant', [
accountModule,
loginModule,
operationModule,
schedulerModule,
ngRoute,
])
.config(function($routeProvider) {
// Defining template and controller in function of route.
$routeProvider
.when('/account/:accountId/operations', {
templateUrl: operationsTmpl,
controller: 'OperationController',
controllerAs: 'operationsCtrl'
})
.when('/account/:accountId/scheduler', {
templateUrl: schedulerTmpl,
controller: 'SchedulerController',
controllerAs: 'schedulerCtrl'
})
.when('/accounts', {
templateUrl: accountsTmpl,
controller: 'AccountController',
controllerAs: 'accountsCtrl'
})
.otherwise({
redirectTo: '/accounts'
});
});
module.exports = app;
]).config(routing);