$location.search() is not working - AngularJs 1.5 $location.search() is not working - AngularJs 1.5 angularjs angularjs

$location.search() is not working - AngularJs 1.5


Of course it's not a function, because you are calling search method on the $scope object. The order of the services you inject into controller is $location then $scope. So what you called $location in controller is actually a $scope. Order is important.

Correct dependency injection should be:

[ '$location', '$scope', function($location, $scope) {