In my project I have got a "back button" that is calling a javaScript function that remembers the previous url when called.
//back button function
function goBack() { $window.history.back(); }
the url being remembered or being called when the back button is clicked contains an ID and this is ID is used to filter data. The main problem i'm having is that this ID is being returned as a string encoded in html. for example this is the url being called:
//Lookups?$filter=VehicleId%20eq%20%272415%27&
As you can see VehicleId is 2415 in above url, which is also encoded to %20%272415%27&. this in plain text is VehicleId = "2415". This is clashing with my program as my program is expecting an int variable instead of a string.
To resolve this i am trying to de -encode?? from html to make the ID to an int. and i having been looking at this http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_unescape but i still can't figure how to put this in my project.
I am using $location in order to remember the ID in url like so:
if ($location.search().vehicle) {
var str = vehicle;
var strEsc = unescape(str);
vehicle = strEsc;
vehicle = $location.search().vehicle;
}
To be honest i don't if i am doing this right (which i'm not sure) ..Is any one to help with this please?