I have an application in which I compose forms using several form components. Now I want to create some kind of foreign key field, which lists already existing objects, as well as the "add" button. This button displays another form component in a modal dialog box. The form 'sub' is simply displayed with <ng-content>. It all works great.
I will illustrate the situation. This is the template <form-component>:
<form class="form">
<form-field>
<another-form-component (save)="handleSave()"></another-form-component>
</form-field>
</form>
Template <form-field>:
<modal-dialog-component [(visible)]="showForm">
<ng-content></ng-content>
</modal-dialog-component>
<div class="form-field">
<select> </select>
<button (click)="openForm($event);">Create new</button>
</div>
As you can see, it <another-form-component>has @Output()an event for him save. That EventEmitter.
: EventEmitter <form-field>? , , <modal-dialog>.
: <ng-content>. @ViewChildren <form-field> - addEventListener()? - ?
, !
,
Johan