创建操作符
repeat
of('leon').pipe(repeat(3)).subscribe(console.log)
// OUTPUT
// leon
// leon
// leonfrom
从一个
数组、类数组对象、Promise 对象、可迭代(Iterable)对象或类可观察对象创建一个 Observable对象。import { from } from 'rxjs';
const arraySource = from([1, 2, 3, 4, 5]);
arraySource.subscribe(val => console.log(val));
// OUTPUT
1
2
3
4
5