Constructor
# new ComponentRendererComponent()
This component provides a flexible way to dynamically render Angular components at runtime based on a tag name. It handles the creation, property binding, and event subscription for dynamically loaded components. This is particularly useful for building configurable UIs where components need to be determined at runtime.
Dynamic component renderer for Decaf Angular applications.
classDiagram
class ComponentRendererComponent {
+ViewContainerRef vcr
+string tag
+Record~string, unknown~ globals
+EnvironmentInjector injector
+ComponentRef~unknown~ component
+EventEmitter~IBaseCustomEvent~ listenEvent
+ngOnInit()
+ngOnDestroy()
+ngOnChanges(changes)
-createComponent(tag, globals)
-subscribeEvents()
-unsubscribeEvents()
}
ComponentRendererComponent --|> OnInit
ComponentRendererComponent --|> OnChanges
ComponentRendererComponent --|> OnDestroy
- Implements:
- OnInit
- OnChanges
- OnDestroy
View Source lib/components/component-renderer/component-renderer.component.ts, line 61
Example
<ngx-decaf-component-renderer
[tag]="tag"
[globals]="globals"
(listenEvent)="listenEvent($event)">
</ngx-decaf-component-renderer>