Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Querystring with $location.path() in AngularJS

Tags:

I want to redirect user to another page after successful login using query string. If I copy & paste to browser's address bar http://example.com/#/login?ref=/path/to/redirect it works fine. But if I use

$location.path("/login?ref=/path/to/redirect"); 

url looks like

http://example.com/#/login%3Fref=/path/to/redirect 

How can I decode %3F to '?' ? Thanks

like image 816
aikutto Avatar asked Jun 12 '14 15:06

aikutto


People also ask

How do I pass QueryString?

To pass in parameter values, simply append them to the query string at the end of the base URL. In the above example, the view parameter script name is viewParameter1.

What is location absUrl ()?

1. absUrl() Method: It returns the full path of your page and it is a read-only method. HTML.


1 Answers

It should be

$location.path('/login').search('ref', '/path/to/redirect') 
like image 194
Stepan Suvorov Avatar answered Sep 28 '22 09:09

Stepan Suvorov