1

I have the following code

 <p class="form-control-static col-sm-7"><a target="_blank" ng-href='/app.html#/playout-search?air_date={{dc.info.air_date}}&market={{dc.info.market}}&syscode={{dc.info.syscode}}&network={{dc.info.network}}&spot_uuid={{dc.info.spot_uuid}}'>{{dc.info.spot_uuid}}</a></p>

Which with data looks like this

<p class="form-control-static col-sm-7"><a target="_blank" ng-href='/app.html#/playout-search?air_date=2017-05-24&market=BOST&syscode=8369&network=TRAV-HD&spot_uuid=NZEKpL33iE+UDpqixAVtmg%3D%3D'</a></p>

My issue is that when the user clicks on the link and gets redirected the URL the '+' signs get converted into '%20'

/app.html#/playout-search?air_date=2017-05-24&market=BOST&syscode=8369&network=TRAV-HD&spot_uuid=NZEKpL33iE%20UDpqixAVtmg%3D%3D

Making the user unable to see the correct data, any input will be appreciated thanks

1 Answer 1

2

Use the decodeURIComponent() method of JavaScript. So inside your HTML get the href dynamically:

<p class="form-control-static col-sm-7"><a target="_blank" ng-href="{{getMyHREF();}}">{{dc.info.spot_uuid}}</a></p>

And inside your controller define that function and return that value:

$scope.getMyHREF = function() {
  return decodeURIComponent(MYCOMPOSEDHREFHERE);
}
Sign up to request clarification or add additional context in comments.

2 Comments

I tried it and when I click on the link it doesn't return the URL, the redirect looks like this /dc.getMyHREF() with a 404 returning
sorry add {{ }}. Updating the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.