0

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 ?

Amb
  • 3,343
  • 7
  • 27
  • 34
  • not clear what you need, or where you want to access it – charlietfl Mar 16 '13 at 11:19
  • for example, my clientside url is http://loacalhost.com/myApp/#!/items?page=1 and serverside url to get data is http://localhost.com/myProject/item/index.json?page=1... I want to get this serverside url which will go in $http.get(url).. – Amb Mar 16 '13 at 11:39
  • 1
    use `$location.path()` and `$location.search()` to create url – charlietfl Mar 16 '13 at 13:45

0 Answers0