I think an observable may not be the right thing to use here but I'm not sure what else I could use to provide live updates of a variable's value to another class.
I have this loop in a service class
elements.forEach(element => {
doStuff();
this.numberSubject.next(valueFromDoStuff);
})
and a subscription to the observable in my component class
numberSubjectObservable.subscribe(result => {
this.value = result
}
What I want is to be able to pause the loop until my Angular component is updated with the newest value from the subscription but right now it waits until the end before rendering the final value.