I have a project in Angular Material where I am using an md-icon with a specific svg structure:
<md-icon class="ic1" md-svg-src='data:image/svg+xml,
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 32 32">
<ellipse ry="16" rx="16" id="svg_1" cy="16" cx="16" stroke-width="1.5" fill="#ff0000"/>
</svg>' class="s32">
</md-icon>
However, Angular is blocking the call to https://www.w3.org/2000/svg
(both HTTP and HTTPS) which results in a $sce:insecurl error:
https://i.stack.imgur.com/vGFde.png
I followed the documentation and tried adding the URL to the SCE whitelist like this:
app.config(function ($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.w3.org/2000/svg', 'https://*.w3.org/**'])
})
Unfortunately, this step did not solve the issue.
Can someone please guide me on how to resolve this problem?
Note that the HTML provided here is simplified; in reality, I dynamically change the fill color of the SVG based on a variable. So, if possible, I would prefer not to save each SVG as a separate file but rather make this dynamic version work.