I am trying to get query string values using angularjs.
my Url: http://localhost/example.php?sportsId=3
when I applied var goto = $location.search()['sportsId'];
it returns me undefined.
However, if I add hash in url like Url: http://localhost/example.php#?sportsId=3
then it returns me correct value 3.
But in this case, it also gives me Error: [$parse:syntax] http://errors.angularjs.org/1.3.8/$parse/syntax?p0=undefined&p1=not%20a%20primary%20expression&p2=null&p3=sportsID%3D&p4=sportsID%3D
Also, my default $_REQUEST['sportsId']
is not working with hash format.
How can I correctly get values from query string by using angularjs?