错误 --> 使用 angular4 时找不到管道“过滤器" [英] error -->The pipe 'filter' could not be found while using angular4
本文介绍了错误 --> 使用 angular4 时找不到管道“过滤器"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 angular4 -node.js 部署的项目中进行单元测试.在测试时我发现了这个错误 -
I am doing unit-testing in angular4 -node.js deployed project.And while testing i found this error -
Template parse errors:
The pipe 'filter' could not be found ("
</thead>
<tbody>
<tr *ngFor="let[ERROR ->] dat of result | filter:filterdata|
paginate: { itemsPerPage: 5, currentPage: p };let i = index ">
所以我将这两个模块添加到我的 module.ts 和 spec.ts 文件中 -->
so i added these two modules to my module.ts and spec.ts files -->
import { PipesModule } from '../../pipes/pipes.module';
import { Pipe, PipeTransform } from '@angular/core';
@NgModule({
imports: [PipesModule
],
对于这个特定的模块导入 -->
And for this particular module import -->
import { PipesModule } from '../../pipes/pipes.module';
错误 --> 找不到模块../../pipes/pipes.module".
Error -->Cannot find module '../../pipes/pipes.module'.
请帮忙解决问题
推荐答案
您必须在 PipesModule 的声明和导出中包含 FilterPipe.
You must include FilterPipe in the declarations and exports of your PipesModule.
这篇关于错误 --> 使用 angular4 时找不到管道“过滤器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文