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,
Believe you really are sort of barking up the wrong tree... you need to take a look at $http service which gives you $http.get(url, config) or $http.post(url, data, config). For a GET request with parameters see the following SO
$http get parameters does not work
For information about $http and how it works see the Angular docs.
http://docs.angularjs.org/api/ng.$http
Perhaps I'm misunderstanding the goal though and you actually want to navigate to a different place, what I suggest here is just to make the request in the background (AJAX style).
http://jsfiddle.net/4ZcUW/
The JS
angular.module("myApp", []).controller("MyCtrl", ["$scope", "$window", function($scope, $window) {
$scope.goPlaces = function(url, parameter) {
$window.open("http://www."+url+"?q="+parameter);
//$window.open("http://www."+url+"?q="+parameter, "_self");
//$window.open("http://www."+url+"?q="+parameter, "_top");
};
}])
The HTML
Does this work for your case?