1

I'm trying to get the params of the URL originally entered in the browser. But angular "redirects" me automatically to '/'

For example, I enter this URL : http://localhost:9080/#/test?param1=en&param2=55

But I end up getting : http://localhost:9080/#/

var config = function (AppConfig, $urlRouterProvider) {
    'ngInject';

    $httpProvider.interceptors.push(function ($q, $location) {
        return {
            'request': function (config) {
                var params = $location.search(); //here : $location is already returning the wrong URL : http://localhost:9080/#/
                return config;
            }

        }
    });

};

Here is my only route :

$stateProvider.state('test', {
        url: '/',
        views: {
            'testView@' : {
                templateUrl: '/app/test/test.html',
                controller: 'test.controller',
                controllerAs: 'testVM'
            }
        }
    });

Why is that ? Is there a way to get the original URL ?

1
  • show your routes definition Commented Dec 17, 2016 at 0:10

1 Answer 1

2

Use:

document.URL;

Or

window.location.href 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.