We can use angular's $location.search() for this instead of writing our own function.
(http://stackoverflow.com/a/11509845)