I am trying to retrieve my URL querystring in AngularJS using the $location
service, similar to this example.
My URL looks like this -
http://someDomain.com/create/index.jsp?queryToken=123abc
However, in my directive:
vm.queryParam = $location.search();
$log.log('vm.queryParam', vm.queryParam); //{}
vm.details.query = vm.queryParam.queryToken;
$log.log('vm.queryToken', vm.details.query); //undefined
Although I can see the parameter(s) when logging the $location
object, it seems that the search()
method is not working as expected. Can anyone suggest the correct way to extract them?
Thank you.