Ionic+ phonegap url parameters not available when the back button is pressed

I am trying to pass a user_id parameter with the url and then retrieve it on the other page by calling $ in the controller of that page.
This works in my browser, but when i test on my android phone it seems to have a problem.
The first time the link is clicked it goes to the correct page and the user_id is retrieved, but if i navigate away from the user-profile page and then press the back button to return to it, the url parameter is not available.

Am i trying to do the wrong thing? Should i be using some other method ?


Well i solved this issue by setting up parameters in angular ui-router.
This way you can retrieve the parameters using $stateParams even when you go back in history.

Keep in mind that using $location.path to redirect the page and trying to retrieve the parameters using ($ will work in the browser even when going back in history, but will fail on the actual device.

Why use a query param at all?

Perhaps this instead:

ui-sref="user-profile({userId : user.user_id}):

.state('user_id', {
    url: '/user_id/:userId',
    templateUrl: 'templates/user_detail',
    controller : 'UserDetailController'

Yeah your right this is more appropriate. Thanks!