Reputation: 79
I have a click functions.In 1st click function i add the key value pair for existing url like this
$scope.OnItemClick = function (bedroom) {
$location.path("/builders/"+r.id).search({bedrooms:bedroom});
}
so in remaining functions.I want to add extra key value pair based on existing url
$scope.range = function (range) {
$location.path("/builders/"+r.id).search({budget:range});
}
$scope.status = function (status) {
$location.path("/builders/"+r.id).search({status:status});
}
i tried to adding key value pair but its over riding each other like this.
1st click : ../#/builders/1?bedrooms=1
2nd click :../#/builders/1?budget:5(overriding)
3rd click :../#/builders/1?status:9(overriding)
so i want to do like this based on clicking functions:
../#/builders/1?budget=5&bedrooms=1&status=9
../#/builders/1?bedrooms=1&status=9&budget=5
../#/builders/1?bedrooms=1&budget=5&status=9
Upvotes: 2
Views: 168
Reputation: 701
$location return search part of current URL.
You can do something like this:
$scope.range = function (range) {
var current = $location.search();
current.budget = range;
$location.search(current);
}
Upvotes: 1