【发布时间】:2018-10-17 12:43:26
【问题描述】:
Observable.of([]); 的正确表达式和导入是什么。
import { of } from 'rxjs'; 不适合我。
【问题讨论】:
-
你只需要导入Observable
-
你能试试这个 import { Observable, of } from 'rxjs';
-
import { of } from 'rxjs/observable/of'在 RxJS 6 中不起作用 -
import { Observable, of } from 'rxjs';是同样的问题 -
这个问题不是 stackoverflow.com/questions/36568388/… 的重复,因为 OP 使用的是 RxJS 6,并且在引用的问题中提到的内容将不起作用,因为它已经被弃用了。
标签: angular typescript rxjs rxjs5 rxjs6