I need to pass several parameters to a component:
<sentence [sentence]="text.title" [selectedWord]="selectedWord" (selectionChanged)="selectionChanged($event)"></sentence>
To dynamically create a component, I am using the following code:
addComponent() {
this.compiler.resolveComponent(TaskHeaderComponent).then((factory) =>
this.cmpRef = this.viewContainer.createComponent(factory, 0, this.viewContainer.injector));
}
How can I pass these parameters to the created component:
- Input: [sentence]="text.title" [selectedWord]="selectedWord"
- Output Function: (selectionChanged)="selectionChanged($event)"
Thanks in advance!