【问题标题】:The pipe 'xxx' could not be found (找不到管道“xxx”(
【发布时间】:2018-10-16 01:01:07
【问题描述】:

我正在尝试将搜索添加到 Angular 6。它总是会引发以下错误: 我尝试使用我的自定义管道和从 NPMJS 中下载的第三方,但错误始终相同。

我能做什么?

Uncaught Error: Template parse errors:
The pipe 'searchByName' could not be found ("

              <ul>
                  <li *ngFor="let [ERROR ->]item of catalogStore.catalog | async | searchByName:searchTerm">
                      <!-- <li *ngFo"): ng:///ProductsModule/ProductsViewComponent.html@8:34

【问题讨论】:

  • 如果您使用的是 shared.module,您是否在 app.module 或 shared.module 的声明中包含了管道?
  • 当然。无论如何,ng 会自动放置它,但我检查了它并且它存在

标签: angular6


【解决方案1】:

我以不同的方式解决了它。

我没有使用过滤器,而是添加了以下内容:

<div *ngIf="item.title.indexOf(searchTerm) >= 0>

这就解决了我的问题!!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-29
    • 2017-03-13
    • 1970-01-01
    • 2023-04-09
    • 2016-12-24
    • 2017-09-04
    • 2017-11-29
    • 2017-11-10
    相关资源
    最近更新 更多