Implementing multiple parallel actions in an Angular component has proven to be challenging for me. Following each action (foo), I subscribe to its result.
I've been attempting to determine if any actions are currently running or have completed using a variable called "lock".
for (let a of myary)
{
this.lock ++;
this.foo (a).subscribe (resp =>
{
this.lock --;
}
}
A spinner/hourglass should display while any actions are still in progress.
<spinner *ngIf="lock > 0"></spinner>
However, it seems that the "lock" variable is not being utilized as expected. It appears to be insecure for this type of access. How can I effectively handle this situation in Typescript/Angular?