[英]Does Angular $location service support multiple parameters?
Using Angular's $location.search()
method, it is possible to create a URL parameter, like this: 使用Angular的
$location.search()
方法,可以创建一个URL参数,如下所示:
http://mysite.com/page?param=myParam
Is it possible to create multiple URL parameters, like this? 是否可以创建多个URL参数,像这样?
http://mysite.com/page?param=myParam¶m2=myParam2&...
I've tried adding multiple object parameters to the function call (ex. $location.search({ key1: value, key2: value })
), but I'm only receiving one key/value in the URL. 我已经尝试在函数调用中添加多个对象参数(例如
$location.search({ key1: value, key2: value })
),但我只在URL中接收一个键/值。
Thanks! 谢谢!
It does work in this fiddle: http://jsfiddle.net/PHnLb/42/ 它在这个小提琴中起作用: http : //jsfiddle.net/PHnLb/42/
$scope.changeTarget = function(name) {
$location.search({target : 'Hi', new : 'else'});
}
(Angular 1.1.4, HTML5 mode = true) (Angular 1.1.4,HTML5 mode = true)
Which version of angular are you using? 您使用的是哪个版本的角度?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.