How to build a url with query parameters in Angularjs.
I see the API $location.search()
the problem is $location(url) is to redirect to the url. In my case, I want to pass a url and key:value pairs for the query params and build the url. something like
url: /a/b/c
params: {field1: value1, field2: value2}
result: /a/b/c?field1=value1&field2=value2
I like to use this url for links. I have also seen angular encode ?
, &
characters. Can I avoid this?
Edit:
My intention was to use the url as href for anchor elements. I do use $http to send the request, but sometimes I need to provide a link, with query params (based on the current object)
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…