How do I extract query parameters using ui-router for AngularJS?
In AngularJS' own $location
service I did:
($location.search()).uid
to extract the parameter uid from a URL. What is the corresponding code for ui-router?
See the query parameters section of the URL routing documentation.
You can also specify parameters as query parameters, following a '?':
url: "/contacts?myParam" // will match to url of "/contacts?myParam=value"
For this example, if the url is /contacts?myParam=value
then the value of $state.params
will be:
{ myParam: 'value' }