I have several components in the template which have an <div (click) = "edit (obj)"> </div>
event bound
Same type of handler:
public edit(actdoc: any): void {
this.applicationRelationShipsService
.get(actdoc.actdocid)
.pipe(
indicate(this.loading$),
observableTimestampResponse(),
switchMap((actdoc) =>
this.dialog
.open(DialogAddExistingRelationshipDetailsComponent, {
...this.dialogConfig,
height: '480px',
data: {
appid: this.application.appid,
mode: MODES.EDIT,
actdoc
},
})
.afterClosed()
.pipe(
filter(Boolean),
concatMap(() => this.applicationRelationShipsService.getByAppId(this.application.appid)),
),
),
)
.subscribe((actdocs) => {
this.actdocs = actdocs.slice();
this.changeDetection.detectChanges();
});
}
How to exclude repeated click and this.applicationRelationShipsService.get()
call. until the dialog box opens and then closes. Or the request fails.
As solution I can define a public process$ = new BehaviorSubject<boolean>(false);
in each component and use it in rxjs, but I don't really want to pollute the component by Subject
.