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();

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

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added