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'; |
| 3 | console.log('XOS Helpers Module') |
| 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 | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 15 | angular |
| 16 | .module('xos.helpers', [ |
| 17 | 'ngCookies', |
| 18 | 'ngResource', |
| 19 | 'bugSnag', |
| 20 | 'xos.uiComponents' |
| 21 | ]) |
| 22 | .config(config); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 23 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 24 | function config($httpProvider, $interpolateProvider, $resourceProvider) { |
| 25 | $httpProvider.interceptors.push('SetCSRFToken'); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 26 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 27 | $interpolateProvider.startSymbol('{$'); |
| 28 | $interpolateProvider.endSymbol('$}'); |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 29 | |
Matteo Scandolo | 2ef0cd7 | 2016-04-12 11:59:29 -0700 | [diff] [blame] | 30 | // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html |
| 31 | $resourceProvider.defaults.stripTrailingSlashes = false; |
| 32 | } |
Matteo Scandolo | 889ced3 | 2015-11-04 16:07:09 +0100 | [diff] [blame] | 33 | })(); |