How can I write a function to wait for the return value using rxjs? I want to show the confirm dialog only if MyString is not empty
My code is as below
private showConfirmation(): boolean{
    let confirmResponse = false;
    if( this.MyString!== '' ) {
        this.alertService.confirm( 'Confirm', this.MyString + 'Are you sure you want to proceed?' ).pipe(
            take(1),
            filter( confirm =>  !!confirm),
            tap(value => {
                confirmResponse = true;
            }),
        ).subscribe();
    }
    return confirmResponse;
}
 
    