【发布时间】:2020-05-03 14:07:32
【问题描述】:
我正在寻找一种方法来按需重播我的 http/get 请求,例如在发布从服务器更新我的数据之后。我正在查看重复或扩展运算符,但不确定这是正确的路径。推荐的模式是什么?
const url = 'https://jsonplaceholder.typicode.com/todos/';
const data$ = this.http.get<Todo[]>(url);
data$.subscribe(console.log);
// wait 5 sec for instance, then replay the http get again and get data$ updated
谢谢!
【问题讨论】: