Rendering Dynamic Images with Angle

0

I have an object in the following format:

Withinthemainobjecthasanobjectcalledupload.Thisobjectcontainsinformationabouttheimagestoberendered.

I'mtryingtodothis:

ng-src="{{o.way}}{{o.original_filename}}"

But it does not work at all. Returns the message:

Error: [$ interpolate: noconcat] Error while interpolating: {{o.way}} / {{o.original_filename}} Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required.

I found something about $ sce msn and it helped me mt.

I'm using an angle library to make a slide.

<slidecontainer ng-repeat="o in dataProject.upload.data">
    <slide ng-src="{{o.way}}/{{o.original_filename}}"></slide>
</slidecontainer>
    
asked by anonymous 18.05.2017 / 14:08

1 answer

1

Instead of trying to concatenate the two values in html, create a method in the controller that concatenates the values:

$scope.getProjectUploadUrl = function (project) {
  return project.way + project.original_filename;
};

... then in html you call this method this way:

<slidecontainer ng-repeat="o in dataProject.upload.data">
    <slide ng-src="{{getProjectUploadUrl(o)}}"></slide>
</slidecontainer>

This directive apparently does not allow you to specify more than one expression, as seen in that link .

    
18.05.2017 / 23:17