刚开始接触RxJS,用的版本6,看了文档retry的用法。https://rxjs-cn.github.io/lea... 做实验如下:import { interval, of, throwError } from 'rxjs';import { take, map, retry } from 'rxjs/operators';
const numbers = interval(1000);var example = numbers.pipe(
map((val) => { if(val == 3) { throw new Error('oops!');
} else { return val;
}
},
retry(2)
));
example.subscribe({
next: (val:any) => console.log(val),
error: (val:any) => console.log(val.message)
});这段代码打印,并没有retry,我是哪里用的不对呢?谢谢。012Error: oops!
添加回答
举报
0/150
提交
取消