I want to get configs (for example, url) sent in http request in my routes. Here is my route :
angular.module('myApp', ['myApp.directives', 'myApp.services', 'myApp.filters']).config(
function($routeProvider, $locationProvider, $httpProvider) {
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('!');
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$routeProvider.
when('/', {
templateUrl: 'elements/home/home.html',
controller: homeCtrl
});
});
angular.module('myApp').run(function($rootScope, $location, $http) {
pendingRequests = {};
$rootScope.$watch(function() {
return $location.url();
},
function(newRoute) {
console.log(newRoute);
var requestUrl = ?
pendingRequests[newRoute] = 0;
});
});
now in run module, I want the request url sent for $location.url()
Anybody have idea ?