RxJS - 创建运算符 of

此运算符将接收传递的参数并将其转换为可观察对象。

语法

of(input: array[]):Observable

参数

input − 给定的输入是数组形式。

返回值

它返回一个可观察对象,其中包含来自源可观察对象的值。

示例

import { of } from 'rxjs';

let ints = of(2,4,6,8,10,12);
ints.subscribe(x => console.log(x));

输出

操作员