What is the correct expression and import for Observable.of([]);
.
import { of } from 'rxjs';
does not work for me.
Since RxJS 6 you should import all "creation" observables directly from 'rxjs'
(assuming you have path maps set when bundling your app).
More detailed explanation: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#import-paths
import { of } from 'rxjs';
of(1).subscribe(console.log);
See demo: https://stackblitz.com/edit/typescript-e3lxkb?file=index.ts
无需使用Observable.of(T)而是可以在rxjs 6.3.3中使用以下语法
return new Observable<AppUser>();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.