最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does Angular $location service support multiple parameters? - Stack Overflow

programmeradmin0浏览0评论

Using Angular's $location.search() method, it is possible to create a URL parameter, like this:


Is it possible to create multiple URL parameters, like this?

;param2=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.

Thanks!

Using Angular's $location.search() method, it is possible to create a URL parameter, like this:

http://mysite.com/page?param=myParam

Is it possible to create multiple URL parameters, like this?

http://mysite.com/page?param=myParam&param2=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.

Thanks!

Share Improve this question asked May 13, 2013 at 7:33 user677526user677526
Add a comment  | 

1 Answer 1

Reset to default 17

It does work in this fiddle: http://jsfiddle.net/PHnLb/42/

$scope.changeTarget = function(name) {
    $location.search({target : 'Hi', new : 'else'});
}

(Angular 1.1.4, HTML5 mode = true)

Which version of angular are you using?

发布评论

评论列表(0)

  1. 暂无评论