-3

I enter url http://localhost/HTMLUS12706?key=1234 which redirects to http://localhost/HTMLUS12706/?key=1234#/index.

Now I need to remove ?key=1234 from url and update url to http://localhost/HTMLUS12706/#/index.

I have already tried these

        $location.search('key', null);
        $location.url($location.path());
        delete $location.$$search.key;
        $location.$$compose();
        $location.$$search = {};
        $location.search({});
3
  • Possible duplicate of AngularJS: How to clear query parameters in the URL? Commented Mar 28, 2017 at 6:14
  • I have already gone through this question but nothing works. Commented Mar 28, 2017 at 6:21
  • What do you see in $location.$$search object? Commented Mar 28, 2017 at 10:13

2 Answers 2

0

You can use $location service to get the url params. Like this,

$location.search().key
Sign up to request clarification or add additional context in comments.

Comments

0

$location has a method called url( urlString ) which sets the path to urlString. Check this. The same method when called without params returns the current url path.

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.