Hey there, I am currently working on a dynamic form utilizing a dynamic component loader. The parent component structure is as follows:
<div class="item-form-block-content">
<div class="form-block">
<ng-template pf-host></ng-template>
</div>
</div>
Within this structure, there are multiple child components that are placed inside the ng-template. My goal is to pass data from the child components to the parent component by utilizing an EventEmitter
.
For instance, let's consider one of the child components:
<input type="text" [(ngModel)]="value" (change)="onValueChange(value)"/>
Here is the corresponding controller code:
export class childComp implements OnInit {
@Output() someVar = new EventEmitter<any>();
onValueChange(val: any) {
this.someVar.emit(val);
}}
The question now is, how can I successfully pass the someVar
variable from the child component to the parent component?