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));

輸出

of Operator
廣告
© . All rights reserved.