Reputation: 8820
I have an array of user ids. I want to pass user ids to $location.search
$scope.userIds = [1, 2];
$location.search({'userId[]' : $scope.userIds}).path('/search');
It give a URL
/search?userId%5B%5D=1&userId%5B%5D=2
if I remove %5B%5D unwanted chars then it works
How to remove them?
Upvotes: 2
Views: 2477
Reputation: 1843
To eliminate the unwanted characters Try removing the "[ ]" like so:
$location.search({'userId': $scope.userIds}).path('/search')
hope it helps
Upvotes: 4