I am writing code for a SPA in AngularJs. I am using ui-router
instead of ngRoute
in this for routing and controlling navigation. In my application there is a situation where I am passing the userId through the url for editing information of that specific user.
My routing for the specific case looks like:
.state('user-edit', {
url: '/users/:uId/:operation',
templateUrl: 'views/user.html',
controller: 'UserCtrl'
})
My related markup is:
<td><a ng-href='#/users/{{user.id}}/edit'><img src="images/edit-icon20.png"></a></td>
A part of my Controller:
if ($stateParams.operation == 'edit'){
*My Logic*
}
My URL now appears like:
http://localhost:8080/#/users/3/edit
Problem:
In this or such URLs, I don't want the user to see my userID. I either want it to be shown as something else or I want it completely hidden. I have gone though the question AngularJS: How to clear query parameters in the URL? here on Stackoverflow but that does not help me as my URL is in a different format.
Question
I need to pass that userID to a REST call. So how do I hide it or scramble it?