I am looking for (simple as possible) ways to compress a url that I am creating.
I am generating it off an object, and the object has only 2 items with values of objects with 2 items inside of that, and already it's getting pretty big. Here's what I have for reference:
For getting the url :
StateString.decode($location.search().state);
For setting it :
$location.search({state: StateString.encode(myObject)});
The Statestring just run then through this -
return {
encode: function(data) {
return encodeURIComponent(JSON.stringify(data));
},
decode: function(searchString) {
if(searchString){
return JSON.parse(decodeURIComponent(searchString));
}else{
return
}
}
Just set in an angular factory for some re-use.
So - I am looking for ways to lighten the load a little with the url string, it's pretty long right now, even with just a few things inside of it. It would be nice to not have to rely on another js library for this (but if I have to, then I have to). Looking for any insight/tips on taking this on. Thanks for reading!