$location.search()
returns an object, consisting of the keys as variables and the values as its value.
So: if you write your query string like this:
?user=test_user_bLzgB
You could easily get the text like so:
$location.search().user
If you wish not to use a key, value like ?foo=bar, I suggest using a hash #test_user_bLzgB ,
and calling
$location.hash()
would return 'test_user_bLzgB' which is the data you wish to retrieve.
Additional info:
If you used the query string method and you are getting an empty object with $location.search(),
it is probably because Angular is using the hashbang strategy instead of the html5 one...
To get it working, add this config to your module
yourModule.config(['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true);
}]);
$location.search()
but I wish to check the "object" that you get when you call it...