Angularjs $location service apparently not parsing url? Angularjs $location service apparently not parsing url? angularjs angularjs

Angularjs $location service apparently not parsing url?


I was having the same problem before I configured $locationProvider in my app's module config:

appModule.config(['$locationProvider', function($locationProvider) {        $locationProvider.html5Mode(true);    }]);


If you don't want to specify the base tag, you can specify require base false.

myapp.config(function($locationProvider) {    $locationProvider.html5Mode({      enabled: true,      requireBase: false    });});


When I encountered this problem, another thing that worked for me besides setting the configuration is to add "#" in front of the query string.

So if you are the one creating the query string, then changing
myapp/?client=clientName
to
myapp/#?client=clientName

allowed $location.search() to give me a non-empty object which you can then access each parameter using $location.search()['client']