If your route was configured to receive that parameters you can observe $stateChangeStart
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
console.log(toParams);
}
If not, there is a workaround (works perfectly :D):
One by one
function getParamByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
getParamByName('param1');
Or all
function getQueryParams(qs) {
qs = qs.split('+').join(' ');
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}
return params;
}
console.log(getQueryParams(document.location.search));