javascript - Angular ng-style background image when url contain spaces -
i'm trying apply background image div using angular ng-style
, works fine long url not contain spaces.
ng-style="{'background-image': 'url(' + parentimglink + ')'}"
when there space in url parentimglink = servername.images/there name.png
not work. on other hand:
img ng-src={{parentimglink }}
works fine. sure can manage names on server wont contain spaces there possibility make ng-style work?
you can try this. in js, replace " " %20 (percent-encoded space).
parentimglink = parentimglink.replace(" ", "%20");
Comments
Post a Comment