Answer the question
In order to leave comments, you need to log in
How to insert EmbededView into DOM?
Hello, I have a problem when trying to dynamically generate a table. At first the problem was solved with Renderer2, but then the binding to the elements turned out to be necessary (for [disabled]) and everything went crashing. Please help.
It is necessary to insert ng-template, which is obtained in the code via @ViewChild() val: TemplateRef in the DOM element, which is accessed via ElementRef.
In this case, templates are used due to the fact that a binding to the [disabled] field is needed. ElementRef is used because of the dynamic generation of table rows and cells. (All this is needed to build a dynamic table).
Example (there should be several of them by switch ... case)
<ng template #tpl1>
<input type="number" (change)="onTopInputChange">
<input type="checkbox" (change)="onTopCheckboxChange">
</ng-template>.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question