Angular 6 - Observable explanation in plain English

后端 未结 4 504
被撕碎了的回忆
被撕碎了的回忆 2020-12-28 11:36

I\'m looking for a plain English explanation of what an Observable is in RXJS.

What it can be used for, and any useful explanations either video links, tutorials, us

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 12:02

    It's like an event, by subscribing you are saying "let me know when this happens..".. so let's say you do a http request, you dont really know how long it will take, so the observable is just a placeholder or event you can subscribe to, which says when this happens, do something. That is, When this http request comes back, whenever that happens to be, read the value. The function you subscribe with will be run when it comes back.

提交回复
热议问题