简体   繁体   中英

how can i add key value pair to the url which already existed key value pair in angularjs?

I have to 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

我想您可以这样做并相应地访问它们。

search({ "bedrooms" : "your_bedroom", "budget" : "your_range", "status" : "your_status"});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM