For instance, let's say I have the following URL: http://local.com/
. When I invoke a function in my SearchController
, I want to set the parameter text=searchtext
and obtain a URL like this:
http://local.com/?text=searchtext
.
What is the correct way to achieve this? I attempted using
$location.search('text', 'value');
but ended up with the following URL:
http://local.com/#?text=searchtext
$scope.searchTracks = function() {
Search.search.get($scope.params, function(data) {
/** Set params in query string */
$location.search('text', $scope.text);
$location.search('sorted', $scope.sorted);
});
}