Update configuration.

This commit is contained in:
Alexis Lahouze 2016-02-07 23:07:40 +01:00
parent 1dbc037122
commit f97a4a7655

View File

@ -41,41 +41,55 @@ var accountantApp = angular.module("accountantApp", [
return sessionInjector;
}])
.config(["$httpProvider", "$routeProvider", "$locationProvider", "$storageProvider", "$resourceProvider",
function($httpProvider, $routeProvider, $locationProvider, $storageProvider, $resourceProvider) {
.config(['$httpProvider', function($httpProvider) {
// Define interceptors.
$httpProvider.interceptors.push('sessionInjector');
}])
.config(['$routeProvider', function($routeProvider) {
// Defining template and controller in function of route.
$routeProvider.when('/account/:accountId/operations', {
$routeProvider
.when('/account/:accountId/operations', {
templateUrl: 'static/templates/operations.html',
controller: 'OperationController'
}).when('/account/:accountId/scheduler', {
controller: 'OperationController',
controllerAs: 'operations'
})
.when('/account/:accountId/scheduler', {
templateUrl: 'static/templates/scheduler.html',
controller: 'SchedulerController'
}).when('/accounts', {
controller: 'SchedulerController',
controllerAs: 'scheduler'
})
.when('/accounts', {
templateUrl: 'static/templates/accounts.html',
controller: 'AccountController'
}).when('/', {
redirectTo: 'accounts'
});
controller: 'AccountController',
controllerAs: 'accounts'
})
.otherwise({
redirectTo: '/accounts'
});
}])
.config(['$locationProvider', function($locationProvider) {
// Enable HTML5 mode.
$locationProvider.html5Mode(true);
}])
.config(['$storageProvider', function($storageProvider) {
// Configure storage
// Set global prefix for stored keys
$storageProvider.setPrefix("accountant");
$storageProvider.setPrefix('accountant');
// Change the default storage engine
// Defaults to "local"
$storageProvider.setDefaultStorageEngine("session");
// Defaults to 'local'
$storageProvider.setDefaultStorageEngine('session');
// Change the enabled storage engines
// Defaults to ['memory', 'cookie', 'session', 'local']
$storageProvider.setEnabledStorageEngines(['local', 'session']);
}])
.config(['$resourceProvider', function($resourceProvider) {
// Keep trailing slashes to avoid redirect by flask..
$resourceProvider.defaults.stripTrailingSlashes = false;
}])