Matteo Scandolo | a5d03d5 | 2016-07-21 11:35:46 -0700 | [diff] [blame] | 1 | (function() { |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * @ngdoc overview |
| 6 | * @name xos.helpers |
| 7 | * @description |
| 8 | * # xos.Helpers |
| 9 | * A collection of helpers to work with XOS <br/> |
| 10 | * Currently available components are: |
| 11 | * - [NoHyperlinks](/#/module/xos.helpers.NoHyperlinks) |
| 12 | * - [SetCSRFToken](/#/module/xos.helpers.SetCSRFToken) |
| 13 | * - [xosNotification](/#/module/xos.helpers.xosNotification) |
| 14 | * - [XosUserPrefs](/#/module/xos.helpers.XosUserPrefs) |
| 15 | * <br/><br/> |
| 16 | * A set of angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource) is provided to work with the API.<br> |
| 17 | * You can find the documentation [here](#/rest-api) |
| 18 | **/ |
| 19 | |
| 20 | angular |
| 21 | .module('xos.helpers', [ |
| 22 | 'ngCookies', |
| 23 | 'ngResource', |
| 24 | 'ngAnimate', |
| 25 | 'xos.uiComponents' |
| 26 | ]) |
| 27 | .config(config) |
| 28 | |
| 29 | /** |
| 30 | * @ngdoc service |
| 31 | * @name xos.helpers._ |
| 32 | * @description Wrap [lodash](https://lodash.com/docs) in an Angular Service |
| 33 | **/ |
| 34 | |
| 35 | .factory('_', $window => $window._ ); |
| 36 | |
| 37 | function config($httpProvider, $interpolateProvider, $resourceProvider) { |
| 38 | $httpProvider.interceptors.push('SetCSRFToken'); |
| 39 | |
| 40 | // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html |
| 41 | $resourceProvider.defaults.stripTrailingSlashes = false; |
| 42 | } |
| 43 | })(); |