Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 1 | (function() { |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 2 | 'use strict'; |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 3 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 4 | angular.module('bugSnag', []).factory('$exceptionHandler', function () { |
| 5 | return function (exception, cause) { |
| 6 | if( window.Bugsnag ){ |
| 7 | Bugsnag.notifyException(exception, {diagnostics: {cause: cause}}); |
| 8 | } |
| 9 | else{ |
| 10 | console.error(exception, cause, exception.stack); |
| 11 | } |
| 12 | }; |
| 13 | }); |
Matteo Scandolo | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 14 | |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 15 | /** |
| 16 | * @ngdoc overview |
| 17 | * @name xos.helpers |
| 18 | * @description this is the module that group all the helpers service and components for XOS |
| 19 | **/ |
| 20 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 21 | angular |
| 22 | .module('xos.helpers', [ |
| 23 | 'ngCookies', |
| 24 | 'ngResource', |
Matteo Scandolo | c88bb9f | 2016-04-25 10:31:22 -0700 | [diff] [blame] | 25 | 'ngAnimate', |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 26 | 'bugSnag', |
Matteo Scandolo | 2aca9ab | 2016-05-26 15:09:55 -0700 | [diff] [blame^] | 27 | 'xos.uiComponents' |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 28 | ]) |
Matteo Scandolo | c49f53c | 2016-04-20 11:38:42 -0700 | [diff] [blame] | 29 | .config(config) |
Matteo Scandolo | 741d6b4 | 2016-05-25 16:02:16 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * @ngdoc service |
| 33 | * @name xos.helpers._ |
| 34 | * @description Wrap [lodash](https://lodash.com/docs) in an Angular Service |
| 35 | **/ |
| 36 | |
Matteo Scandolo | c49f53c | 2016-04-20 11:38:42 -0700 | [diff] [blame] | 37 | .factory('_', $window => $window._ ); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 38 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 39 | function config($httpProvider, $interpolateProvider, $resourceProvider) { |
| 40 | $httpProvider.interceptors.push('SetCSRFToken'); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 41 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 42 | $interpolateProvider.startSymbol('{$'); |
| 43 | $interpolateProvider.endSymbol('$}'); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 44 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 45 | // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html |
| 46 | $resourceProvider.defaults.stripTrailingSlashes = false; |
| 47 | } |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 48 | })(); |