刚从rxjs5/ angular 5迁移到rxjs6/angular 6,经历了这个migration-guide。似乎不知道现在应该是什么,感谢任何帮助。
import { Observable, of } from 'rxjs';
[ts] 'of' is declared but its value is never read.
// trivial example of what im trying to replace
isLoggedIn(): Observable<boolean> {
return Observable.of(true);
}
发布于 2018-06-08 07:03:06
您现在可以只从rxjs
导入of
。所以..。
import { Observable, of } from 'rxjs';
// trivial example of what im trying to replace
isLoggedIn(): Observable<boolean> {
return of(true);
}
发布于 2020-04-17 20:14:52
如果您使用的是Angular 6 /7或9
import { of } from 'rxjs';
然后,不是调用
Observable.of(res);
只需使用
of(res);
https://stackoverflow.com/questions/50751254
复制相似问题