Observable Finally on Subscribe

后端 未结 3 703
无人及你
无人及你 2020-12-02 13:02

According to this artcle, onComplete and onError function of the subscribe are mutually exclusive.

Meaning either onEr

3条回答
  •  执念已碎
    2020-12-02 13:10

    The only thing which worked for me is this

    fetchData()
      .subscribe(
        (data) => {
           //Called when success
         },
        (error) => {
           //Called when error
        }
      ).add(() => {
           //Called when operation is complete (both success and error)
      });
    

提交回复
热议问题