我正在 angular4 -node.js 部署项目中进行单元测试。在测试时我发现了这个错误 -

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 文件中 -->
import { PipesModule } from '../../pipes/pipes.module';
import { Pipe, PipeTransform } from '@angular/core';

@NgModule({
 imports: [PipesModule
 ],

对于这个特定的模块导入 -->
import { PipesModule } from '../../pipes/pipes.module';

错误 --> 找不到模块“../../pipes/pipes.module”。

请帮助解决问题

最佳答案

您必须在 PipesModule 的声明和导出中包含 FilterPipe。

关于angular - 错误 --> 使用 angular4 时找不到管道 'filter',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50075567/

10-11 14:23