From f97a4a76555561605c0289cbc099b895f6c62dd0 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 7 Feb 2016 23:07:40 +0100 Subject: [PATCH] Update configuration. --- accountant/frontend/static/js/app.js | 44 ++++++++++++++++++---------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/accountant/frontend/static/js/app.js b/accountant/frontend/static/js/app.js index 9083a60..632a59d 100644 --- a/accountant/frontend/static/js/app.js +++ b/accountant/frontend/static/js/app.js @@ -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; }])