I am currently iterating through a list of employee objects, each containing an image URL that I need to incorporate into an SVG - Image element.
<div *ngFor ="emp of employees">
<defs>
<pattern id = "attachedImage" height = "100%" width = "100%" patternContentUnits = "objectBoundingBox">
<image href="{{emp.ImageUrl}}" preserveAspectRatio = "none" width = "1" height = "1"/>
</pattern>
</defs>
<circle cx = "50%" cy = "50%" r = "35%" fill = "url(#attachedImage)"/>
</div>
I prefer not to iterate through all the HTML elements in JavaScript. If necessary, I want to associate the correct image with the appropriate object.
Is there a way to dynamically append the URL to this image? I attempted using {{emp.ImageUrl}}, but it did not work as expected.
Here is a URL to a working example where the URL is hardcoded: https://stackblitz.com/edit/angular-pq6r2w
My goal is to add the URL dynamically.
Any suggestions would be greatly appreciated!