javascript - AngularJS: Expression value for REST API call -
i create several dom-elements on website using angularjs ng-repeat, example image objects need loaded dynamically. iterate through json object , each element in json object correct html-output should be:
<img src="/myrestimageservice/{{image.name}}">
taking closer @ rest service on server side, turns out every , value of angularjs-expression {{image.name}} not resolve appended cleartext. of course, leads error prone rest-calls like:
/myrestimageservice/%7b%7bitem.name%7d%7d
what reason , how can fix it?
user angular directive ng-src
instead of src
,so try
<img ng-src="/myrestimageservice/{{image.name}}">
here further documentation ng-src :https://docs.angularjs.org/api/ng/directive/ngsrc
Comments
Post a Comment