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
Post a Comment