How to get Angular2 to bind component in innerHTML

There is no way to make [innerHtml]="..." instantiate Angular components or directives or establish any bindings.

The closest for this requirement is DynamicComponentLoader. (DynamicComponentLoader was removed a while ago) ViewContainerRef.createComponent()

See Angular 2 dynamic tabs with user-click chosen components for an example

Since RC.5 Angular2 sanitizes styles and HTML added through binding.
See In RC.1 some styles can’t be added using binding syntax for more details.

Leave a Comment