Angular: Redirecting to another location with query strings
There are a couple of ways to redirect to a new location:
window.location.href / $window.location.href
However, when using routing ($routeProvider), $location is the way to go.
To navigate to another route:
$location.path("/Search");
$location.replace();
$location.path("/Search").search('k', 'test');
window.location.href / $window.location.href
However, when using routing ($routeProvider), $location is the way to go.
To navigate to another route:
$location.path("/Search");
$location.replace();
To navigate to another route using query strings (such as ?k=test)
$location.path("/Search").search('k', 'test');
To extract the query values, use
$location.search().k;
Comments
Post a Comment