Matteo Scandolo | 817386b | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 1 | (function() { |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 2 | 'use strict'; |
Matteo Scandolo | b585d38 | 2016-06-15 14:53:33 -0700 | [diff] [blame] | 3 | |
Matteo Scandolo | 57404dc | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 4 | /** |
| 5 | * @ngdoc overview |
| 6 | * @name xos.helpers |
| 7 | * @description this is the module that group all the helpers service and components for XOS |
| 8 | **/ |
| 9 | |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 10 | angular |
| 11 | .module('xos.helpers', [ |
| 12 | 'ngCookies', |
| 13 | 'ngResource', |
Matteo Scandolo | b028075 | 2016-04-25 10:31:22 -0700 | [diff] [blame] | 14 | 'ngAnimate', |
Matteo Scandolo | b9fb625 | 2016-05-26 15:09:55 -0700 | [diff] [blame] | 15 | 'xos.uiComponents' |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 16 | ]) |
Matteo Scandolo | 7bc39c4 | 2016-04-20 11:38:42 -0700 | [diff] [blame] | 17 | .config(config) |
Matteo Scandolo | 974c0e4 | 2016-05-25 16:02:16 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * @ngdoc service |
| 21 | * @name xos.helpers._ |
| 22 | * @description Wrap [lodash](https://lodash.com/docs) in an Angular Service |
| 23 | **/ |
| 24 | |
Matteo Scandolo | 7bc39c4 | 2016-04-20 11:38:42 -0700 | [diff] [blame] | 25 | .factory('_', $window => $window._ ); |
Matteo Scandolo | 817386b | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 26 | |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 27 | function config($httpProvider, $interpolateProvider, $resourceProvider) { |
| 28 | $httpProvider.interceptors.push('SetCSRFToken'); |
Matteo Scandolo | 817386b | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 29 | |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 30 | $interpolateProvider.startSymbol('{$'); |
| 31 | $interpolateProvider.endSymbol('$}'); |
Matteo Scandolo | 817386b | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 32 | |
Matteo Scandolo | bd2e5cd | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 33 | // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html |
| 34 | $resourceProvider.defaults.stripTrailingSlashes = false; |
| 35 | } |
Matteo Scandolo | 817386b | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 36 | })(); |