简体   繁体   English

如何将键值对添加到angularjs中已经存在的键值对的url中?

[英]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"});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将键值对附加到 AngularJS 中已经存在的键值对的 url? - How can I append key value pair to the url which already existed key value pair in AngularJS? 如果我不知道哪些键已经存在,如何将键值对添加到JSON列表的末尾? - How can I add a key value pair to the end of a JSON list if I don't know which keys already exist? 如何将键/值对添加到嵌套对象文字中? - How can I add a key/value pair to a nested object literal? 如何将键/值对添加到 JavaScript 对象? - How can I add a key/value pair to a JavaScript object? 如何在 Node.js 的缓冲区中添加键值对 - How can I add a key value pair in a buffer in Node js 如何将键/值对添加到另一个 object 中的 JavaScript object - How can I add a key/value pair to a JavaScript object which is in an another object 如何在已经声明的 JSON 对象中添加键值对 - how to add key value pair in the JSON object already declared 如何在另一个键/值对中使用定义的键 - How can I use defined key in another key/value pair 在Javascript中,如何检查嵌套在另一个键/值对中的特定键/值对的存在? - In Javascript, how can I check the existence of a specific key/value pair nested inside another key/value pair? 尝试向 obj2 添加一个键/值对,我只能通过 obj2 访问(添加不影响它所引用的 object 的键/值对) - trying to add a key/value pair to obj2 that i can access only thru obj2(add key/value pair which doesnt affect the object that it is referencing)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM