wait for eventEmitter code example
Example: wait EventEmitter return
// FILE : child.component.ts
@Input()
set response (v: any) {
// Do some logic here
}
@Output()
callParentFunction = new EventEmitter<any>();
doStuff () {
this.callParentFunction.emit();
}
// FILE : parent.component.ts
public response$: Observable<IResponse | null> = of(null);
parentFunction(){
this.response$ = this.http.get(/* ... */)
}
// FILE : parent.component.html
<child-component
[response]="response$ | async"
(callParentFunction)="parentFunction($event)"
></child-component>