In my component I have a template literal string containing an HTML tag with an camelCase attribute in it:
htmlString = `<mat-icon svgIcon="edit" ...></mat-icon>`;
This string gets assembled as a property of an object in an array forEach loop.
For several reasons in the template I need to output this in an innerHtml attribute within a *ngFor loop:
<li *ngFor="let foo of foos" [innerHTML]="foo.htmlString"></li>
(This is a simplified code example of my implementation.)
I found out that in the output the svgIcon
attribute is rendered in lowercase svgicon
, see DOM inspector output:
<li _ngcontent-qui-c96="">
<mat-icon svgicon="edit"></mat-icon>
</li>
Bug or feature? Couldn't find any info on this behaviour. Thanks for any hint!