blob: af3dd63493c30e732532eaa7333c468587e2d06d [file] [log] [blame]
Matteo Scandolo889ced32015-11-04 16:07:09 +01001(function() {
Matteo Scandolo717352a2016-04-13 17:23:28 -07002 'use strict';
Matteo Scandolo889ced32015-11-04 16:07:09 +01003
Matteo Scandolo717352a2016-04-13 17:23:28 -07004 /**
5 * @ngdoc service
6 * @name xos.helpers.NoHyperlinks
7 * @description This factory is automatically loaded trough xos.helpers and will add an $http interceptor that will add ?no_hyperlinks=1 to your api request, that is required by django
8 **/
Matteo Scandolo889ced32015-11-04 16:07:09 +01009
Matteo Scandolo717352a2016-04-13 17:23:28 -070010 angular
11 .module('xos.helpers')
12 .factory('NoHyperlinks', noHyperlinks);
13
14 function noHyperlinks() {
15 return {
16 request: function(request){
17 if(request.url.indexOf('.html') === -1){
18 request.url += '?no_hyperlinks=1';
Matteo Scandolo889ced32015-11-04 16:07:09 +010019 }
Matteo Scandolo717352a2016-04-13 17:23:28 -070020 return request;
21 }
22 };
23 }
Matteo Scandolo889ced32015-11-04 16:07:09 +010024})();