ionic引用自定义html,pipe - Ionic 4自定义管道可以在app.component.html中正常工作,但不能在其他.html页面上工作(在.ts文件下工作) - 堆栈内存溢出...

我试图在Ionic 4上创建自定义管道。当我在app.component.html上使用此管道时,它工作正常,但在其他.html页面中,它说“找不到管道”。 如果导入,它也适用于所有.ts文件。 如何在.html页面上使用管道。 感谢您的建议。

src/pipes/pipes.module.ts

import { NgModule } from '@angular/core';

import { CommonModule } from '@angular/common';

import { SearchfilterPipe } from './searchfilter.pipe';

@NgModule({

imports: [

CommonModule

],

declarations: [SearchfilterPipe],

exports: [SearchfilterPipe]

})

export class PipesModule { }

/src/pipes/searchfilter.ts

import { Pipe, PipeTransform,Injectable } from '@angular/core';

@Pipe({

name: 'searchfilter',

pure:false

})

@Injectable()

export class SearchfilterPipe implements PipeTransform {

transform(value: any, args?: any): any {

return null;

}

}

/app.module.ts

import { PipesModule } from '../pipes/pipes.module';

@NgModule({

declarations: [AppComponent],

entryComponents: [],

imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule,HttpClientModule,FilterPipeModule,FormsModule,PipesModule],

providers: [

StatusBar,

SplashScreen,

{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },

Crop,

ImagePicker,

File

],

bootstrap: [AppComponent]

})

export class AppModule {}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值