Is an observable the best choice for providing live updates of a variable's value to another class? I have a loop in my service class that looks like this:
elements.forEach(element => {
doStuff();
this.numberSubject.next(valueFromDoStuff);
})
In my component class, I am subscribing to the observable:
numberSubjectObservable.subscribe(result => {
this.value = result
}
I want the loop to pause until my Angular component is updated with the newest value from the subscription. Currently, it waits until the end before rendering the final value.