I wanted to work with query string parameters along with the usual route parameters in an AngularJS application and have been following the solution in this post: how to pass querystring in angular routes?
The solution seems to work: Change the route first with $location.path
and then apply the query string parameters with $location.search
.
However, I came across a scenario where the route does not need to change but the query parameters need to.
For example:
Moving from
'/Books/Programming?id=123'
to
'/Books/Mathematics?id=234'
works fine.
However,
Moving from
'Books/Programming?id=123'
to
'Books/Programming?id=124'
does not work.
It seems that AngularJS is only notified for changes on the regular route parameters and not for changes in the query string parameters so if query string is the only thing that changes in the URL, the application does not respond to the navigation.