I'm creating dynamic html with angular, and I can not make it correctly take the native attributes of angular. this is working correctly in @Component template, but this dose not work within any variable.
...
@Component({
selector: 'app-canvas-render',
template: `<div [innerHtml]="this.objHtmlElement | domSanitizer: 'safeHtml'"></div>`,
})
export class CanvasRenderComponent implements OnInit {
objHtmlElement = `<div div *ngFor="let element1 of objSchemaElement"
[id]="element1.id" [index]="element1.index" class="edited"
[ngStyle]="this.objElements[element1.index].styles | convertToStyle"
[appStyleEditCanvas]="this.objStylesLogs.slice(-1)[0]">
{{element1.id}} - {{element1.index}} - {{element1.type}}
</div>`;
...
the actual output is:
{{element1.id}} - {{element1.index}} - {{element1.type}}
and the output html code is:
<div div *ngfor="let element1 of objSchemaElement"
[id]="element1.id" [index]="element1.index" class="edited"
[ngstyle]="this.objElements[element1.index].styles | convertToStyle"
[appstyleeditcanvas]="this.objStylesLogs.slice(-1)[0]">
{{element1.id}} - {{element1.index}} - {{element1.type}}
</div>