html - Encode AngularJS expression -


this question has answer here:

introduction :

i have expression

{{ track.title }}

it contains 1 word or more 1 word. i.e xyz or xyz abc

this track.title used in url.

http://www.example.com/{{ track.title }} 

problem :

this url working fine 1 word in track.title break more 1 words.

so, want know there way encode url not break while sharing.

any immediate highly appreciable. thanks

you need escape spaces in title somehow.

for readability, instead of using xyz%20abc, might replace them hyphens or underscores instead. xyz-abc or xyz_abc

since still want title displayed on page unescaped, may want create new variable hold escaped version.

track.url = track.title.replace(' ', '-');


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -