I have a component . The content for this component is received by API and it contains another components .
The question is, how to render the child component. When I pu
Even when you use the safeHtml
pipe mentioned in @laser's answer, Angular doesn't process HTML added using innerHTML
. It is just added as HTML and not processed any furter - no components or directives are created, no data binding or event binding will happen.
What you can do is to create a component at runtime with your HTML as template content and then add this component dynamically using ViewContainerRef.createComponent()
and resolveComponentFactory
See also Equivalent of $compile in Angular 2