Angular2. How can I check if an observable is completed?

后端 未结 6 543
轮回少年
轮回少年 2020-12-09 08:39

In my page there is a button that generates a report. That report needs data that is loaded using a http call to a rest endpoint when the page is loaded, but I do not have a

6条回答
  •  星月不相逢
    2020-12-09 09:36

    If you're doing this to debug, the simplest solution is to use the complete argument of tap:

    tap(next: null, error: null, complete: () => void)
    

    With a source source$ it would look like this:

    source$.pipe(
      tap(undefined, undefined, console.log)
    );
    

提交回复
热议问题