tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
324 stars 93 forks source link

Unable to render angular component or directive inside dialog box #224

Closed the-nine-tail closed 3 years ago

the-nine-tail commented 3 years ago

What is the current behavior? htmlpanel of TinyMCE Dialog does not render angular directive such as ngFor or ngIf. CODE---------- items: [{ type: 'htmlpanel', html: <div *ngFor="let a of myarray"> {{a}} </div> }]

What is the expected behavior? Value of array should be printed

Which versions of TinyMCE/TinyMCE-Angular, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or TinyMCE-Angular?

If we need to create a different component then how to include that component in dialog box? I am trying to fetch data from external API into the dialog box. @TheSpyder

jscasca commented 3 years ago

@the-nine-tail Unfortunately, this is not supported. To achieve something like this you would need to compile the Angular code on the fly which I believe is highly discouraged by the Angular team.

So in order to achieve what you are after you would have to create the string using Javascript or have a compiled version of the component hidden somewhere where you can just grab the innerHTML and dump it in the panel.

Let me know if this helps