Separate app.config in another file.
This commit is contained in:
parent
2fb98fdeed
commit
fbeb3fd362
22
src/app.config.js
Normal file
22
src/app.config.js
Normal 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'
|
||||||
|
});
|
||||||
|
};
|
31
src/app.js
31
src/app.js
@ -27,41 +27,18 @@ var accountModule = require('./accounts'),
|
|||||||
operationModule = require('./operations'),
|
operationModule = require('./operations'),
|
||||||
schedulerModule = require('./scheduler');
|
schedulerModule = require('./scheduler');
|
||||||
|
|
||||||
|
var routing = require('./app.config');
|
||||||
|
|
||||||
require('bootstrap-webpack!./bootstrap.config.js');
|
require('bootstrap-webpack!./bootstrap.config.js');
|
||||||
|
|
||||||
var operationsTmpl = require('./operations/operations.html');
|
var operationsTmpl = require('./operations/operations.html');
|
||||||
var accountsTmpl = require('./accounts/accounts.html');
|
var accountsTmpl = require('./accounts/accounts.html');
|
||||||
var schedulerTmpl = require('./scheduler/scheduler.html');
|
var schedulerTmpl = require('./scheduler/scheduler.html');
|
||||||
|
|
||||||
var app = angular.module('accountant', [
|
angular.module('accountant', [
|
||||||
accountModule,
|
accountModule,
|
||||||
loginModule,
|
loginModule,
|
||||||
operationModule,
|
operationModule,
|
||||||
schedulerModule,
|
schedulerModule,
|
||||||
ngRoute,
|
ngRoute,
|
||||||
])
|
]).config(routing);
|
||||||
|
|
||||||
.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;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user