teddybear123
teddybear123

Reputation: 2424

How to decode URL parameter using AngularJS or JavaScript?

I have a value that I pass on to URL parameter the original value looks like this:

1436641259169/nDfmDmVa

when it gets passed on it converts it to this:

1436641259169%252FnDfmDmVa

So, how to do I convert it back when I pull it down?

Upvotes: 8

Views: 25936

Answers (2)

Farouk Mhamdi
Farouk Mhamdi

Reputation: 321

I think this will help you to decode the url :

  decode(content: string){
    return decodeURIComponent(content);
  }

Upvotes: 0

Derek 朕會功夫
Derek 朕會功夫

Reputation: 94299

This may help you: decodeURIComponent

decodeURIComponent(string);

Example:

decodeURIComponent(decodeURIComponent("1436641259169%252FnDfmDmVa"))
> "1436641259169/nDfmDmVa"

Upvotes: 14

Related Questions