【发布时间】:2020-02-02 05:42:44
【问题描述】:
我正在尝试在我的个人培训项目中使用以下pipe,按照我使用 npm 安装库的规范,我可以在 ng 模块文件夹中看到它
然后我尝试在我的app.module 中添加NgPipesModule,如下所示
import {NgPipesModule} from 'ngx-pipes';
@NgModule({
imports: [
BrowserModule,
BoxingSharedModule,
BoxingCoreModule,
BoxingHomeModule,
NgPipesModule,
// jhipster-needle-angular-add-module JHipster will add new module here
BoxingEntityModule,
BoxingAppRoutingModule
],
declarations: [JhiMainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, ActiveMenuDirective, FooterComponent],
providers: [
{
我相信这应该足以使用filterBy 管道!!!
这就是我使用它的方法
<tr *ngFor="let boxer of boxers | filterBy: [searchFilter]: searchValue.value ;trackBy: trackId">
过滤器值由此提供:
<input type="text" class="form-control" placeholder="Search"
aria-label="Search" aria-describedby="basic-addon2" #searchValue>
<div class="input-group-append" (click)="onButtonGroupClick($event)">
<button class="btn btn btn-outline-primary" type="button" value="fullName">FullName</button>
<button class="btn btn btn-outline-primary" type="button" value="phone">Phone Number</button>
<button class="btn btn btn-outline-primary" type="button" value="birthDate">Birth Date</button>
</div>
浏览器控制台日志显示没有管道解析如下:
ERROR 错误:未捕获(承诺):错误:模板解析错误: 找不到管道 'filterBy' ("1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0"> ]oxer of boxers | filterBy: [searchFilter]: searchValue.value ;trackBy: trackId"> = links['last']" [infiniteScrollDistance]="0"> ] 拳击手 | filterBy: [searchFilter]: searchValue.value ;trackBy: trackId">
我不知道我在这里错过了什么?
你应该知道我在使用 JHipster
【问题讨论】:
标签: javascript angular typescript ecmascript-6 single-page-application