angular - 错误 --> 使用 angular4 时找不到管道“过滤器”
问题描述
我正在 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。
推荐阅读
- matlab - 在网格 MATLAB 中定义函数区域
- ios - 由于不可重现的错误,使用 Flutter 制作的 iOS 应用程序被拒绝
- .htaccess - 我正在尝试链接到页面的一部分 (#)。但不适用于重写网址
- java - 记录来电时出错不起作用?
- simulation - 使用 Simpy 模拟具有设置/开启时间的资源系统
- r - R:使用 dplyr 和 geom_text 计算和显示百分比
- presto - PrestoSQL/Trino CLI 从一个文件执行多条语句时,如何打印当前正在运行的 SQL 语句?
- postgresql - 与postgres服务器建立连接,但拒绝从数据库“student”的表“students”中获取数据
- wpf - GridView 标题单元格之间的选项卡不起作用
- java - 如何在外部应用程序 android 中打开存储在应用程序特定存储中的文件?