Skip to content

Instantly share code, notes, and snippets.

@toddmotto
Created May 27, 2014 13:11
Show Gist options
  • Save toddmotto/8d77ac5789cd095d8df2 to your computer and use it in GitHub Desktop.
Save toddmotto/8d77ac5789cd095d8df2 to your computer and use it in GitHub Desktop.
Dynamically change $location (with query params) in Angular using search() and path()

Input:

var someDynamicParam = 9812894732432;
$location.search('myParams', someDynamicParam).path('/request');

Output:

http://127.0.0.1/request?myParams=9812894732432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment