Error: Template parse errors: The pipe 'filter' could not be found in angular
Error: Template parse errors: The pipe 'filter' could not be found in angular
导入了这个过滤器
// search module
import { Ng2SearchPipeModule } from 'ng2-search-filter';
HTML 代码
//search
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="search">
//Assigned filter to table
<tr *ngFor="let bookName of NameOfBookList | filter:searchText">
如有任何帮助,我们将不胜感激。
仅将 Ng2SearchPipeModule
添加到对我有用的导入中。添加到声明时,我的浏览器工具出现错误,指出 Ng2SearchPipeModule
.
出现意外声明
@NgModule({
declarations: [
AppComponent,
ListComponent
],
imports: [
BrowserModule,
FormsModule,
Ng2SearchPipeModule
],
providers: [],
bootstrap: [AppComponent]
})
然后在我的标记中:
<input [(ngModel)]="term">
...
<tbody *ngFor="let d of myList |filter:term">
我遇到了同样的问题。请在 child childmodule.module.ts.
的导入部分添加 import Ng2SearchPipeModule
工作解决方案-
导入了这个过滤器
// search module
import { Ng2SearchPipeModule } from 'ng2-search-filter';
HTML 代码
//search
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="search">
//Assigned filter to table
<tr *ngFor="let bookName of NameOfBookList | filter:searchText">
如有任何帮助,我们将不胜感激。
仅将 Ng2SearchPipeModule
添加到对我有用的导入中。添加到声明时,我的浏览器工具出现错误,指出 Ng2SearchPipeModule
.
@NgModule({
declarations: [
AppComponent,
ListComponent
],
imports: [
BrowserModule,
FormsModule,
Ng2SearchPipeModule
],
providers: [],
bootstrap: [AppComponent]
})
然后在我的标记中:
<input [(ngModel)]="term">
...
<tbody *ngFor="let d of myList |filter:term">
我遇到了同样的问题。请在 child childmodule.module.ts.
的导入部分添加 import Ng2SearchPipeModule工作解决方案-