[英]rxjs/operators: can not find module
I import rxjs/operators like this: 我导入像这样的rxjs /运算符:
import { map } from 'rxjs/operators';
But that gives me the following error: 但是这给了我以下错误:
map is declared but it values is never read.
map已声明但它的值永远不会被读取。 Cannot find module rxjs/operators
找不到模块rxjs /运算符
in Angular. 在Angular。
Please help. 请帮忙。
You are using rxjs version 5.0.0 so you have to import map operator like this :: 您正在使用rxjs版本5.0.0,因此您必须导入这样的地图运算符::
import "rxjs/add/operator/map";
If You are using rxjs version 6.0.0 then you can import like this :: 如果您使用的是rxjs版本6.0.0,则可以像这样导入::
import { map } from 'rxjs/operators'
And if you want to use first method with rxjs version 6.0.0 then you have to install rxjs compat as mentioned in comment by @Sachilla 如果你想使用rxjs版本6.0.0的第一个方法,那么你必须安装rxjs compat,如@Sachilla评论中所述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.