IssueRaiser

Ivy: Render HTML from String / dynamic rendering

### Which @angular/* package(s) are relevant/releated to the feature request? compiler, core, platform-browser-dynamic, platform-browser ### Description As far as I know the old aproach was to inject the JITCompiler and use it to render your HTML in an anonymous component. This worked so far. I use editable HTML in DB which uses key features as substituting variables and directives like *ngIf or *ngSwitch. Which does not work anymore in production mode (Angular 12.x) I browsed stackoverflow and other forums to find an workarround for this and these are not working anymore (like loading the JITCompiler into Providers, which results in "JIT Compiler unavailable". As I found not soulution for ivy/ng 12 i considered this feature as still missing. Best, Malte ### Proposed solution Component to render html strings. Example: ``` Html <render-component [html]="..." [render-data]="{ show: true}></render-component> ```` [html] has the following value: ``` Javascript "<p *ngIf=\"show\">Hello!</p>" ``` Which display in the case if show is true: ``` Html <p>Hello!</p> ``` ### Alternatives considered An Service to render html on the fly. E.g.: [p3x-compile](https://github.com/patrikx3/angular-compile) [Html Compile](https://github.com/codehint-ng/ng-controls/blob/master/projects/html-compiler/src/lib/html-compiler.component.ts)

Posted by nfMalde on Jan 7, 2022, 3:35 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Software)

Ivy: Render HTML from String / dynamic rendering

nfMaldeJan 7, 2022, 3:35 PM

### Which @angular/* package(s) are relevant/releated to the feature request? compiler, core, platform-browser-dynamic, platform-browser ### Description As far as I know the old aproach was to inject the JITCompiler and use it to render your HTML in an anonymous component. This worked so far. I use editable HTML in DB which uses key features as substituting variables and directives like *ngIf or *ngSwitch. Which does not work anymore in production mode (Angular 12.x) I browsed stackoverflow and other forums to find an workarround for this and these are not working anymore (like loading the JITCompiler into Providers, which results in "JIT Compiler unavailable". As I found not soulution for ivy/ng 12 i considered this feature as still missing. Best, Malte ### Proposed solution Component to render html strings. Example: ``` Html <render-component [html]="..." [render-data]="{ show: true}></render-component> ```` [html] has the following value: ``` Javascript "<p *ngIf=\"show\">Hello!</p>" ``` Which display in the case if show is true: ``` Html <p>Hello!</p> ``` ### Alternatives considered An Service to render html on the fly. E.g.: [p3x-compile](https://github.com/patrikx3/angular-compile) [Html Compile](https://github.com/codehint-ng/ng-controls/blob/master/projects/html-compiler/src/lib/html-compiler.component.ts)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue