'Angular 11 how to pass row item from template to observable

html:

    <tr
        *ngFor="let workflow of auditWorkflows"
        class="border-bottom"
        [rowClick]="workflow | auditWorkflowRouteNavigate"
        [rowClickGate]="startAuditIfNotStarted$"
    >

.ts

startAuditIfNotStarted$ = new Observable((subscriber) => {
        if (this.auditInProgress) {
            subscriber.next(true);
            subscriber.complete();
        } else {
***//Here i need to get the current row item i.e workflow.id to do some additional logic***
            this.confirmDialog.confirm({
                header: 'Begin audit',
                message: 'Are you sure you would like to start the audit?',
                acceptLabel: 'Yes',
                rejectLabel: 'No',
                accept: () => {
                    this.auditInstanceService.start(this.auditId).subscribe(() => {
                        this.auditInProgress = true;
                        subscriber.next(true);
                        subscriber.complete();
                    });
                },
                reject: () => {
                    subscriber.next(false);
                    subscriber.complete();
                }
            });
        }
});

directive code block:

@Input('rowClick')
options: RouterNavigateParams;

@Input('rowClickGate')
    gate$?: Observable<boolean>;
    
    private applyGateThen(callback: () => void) {
        if (this.gate$) {
            this.gate$.pipe(take(1)).subscribe((allow) => {
                if (allow) {
                    callback();
                }
            });
        } else {
            callback();
        }
    }

Now, in the existing code , i want to pass the 'workflow' item from *ngFor into the observable, so i can do some additional logic. If i used a method as below, the method is called so many times. Is there a better way to get hold of the row item?

[rowClickGate]="provideSub(workflow)"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source