re: Simple state management in Angular with only Services and RxJS VIEW POST

FULL DISCUSSION
 

First of all, thanks for the article.
Its really great, and certainly expanded my horizons on the use of RxJS.

Just one question, on stack blitz you use toPromise() on the calls to the rest api. This could not also be achieved using observables?

this.todosService.setCompleted(id, isCompleted)
.pipe(take(1))
.subscribe({
next: value => {},
error: err => {
console.error(e);
this.todos[index] = {
...todo,
isCompleted: !isCompleted
}
}
});

I did see that you use it because of async/wait but not understand why.
I'm just trying to understand the difference between the two approaches.

Thanks!

code of conduct - report abuse