相关疑难解决方法(0)

Ionic-3找不到管道

我刚刚升级到Ionic 3.0.1所以我可以使用LazyLoading,因为我不能使用我的自定义Pipes:

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

@Pipe({
  name: 'StripHTML'
})

export class StripHTML implements PipeTransform {

  transform(value, args) {
    let striped = value.replace(/(<([^>]+)>)/g, "");

    if (args != null) {
      if (args.split != null) {
        striped = striped.split(args.split);
        if (args.index != null) {
          striped = striped[args.index];
        }
      }
    }

    return striped;
  }
}
Run Code Online (Sandbox Code Playgroud)

并在app.module.ts我已将其添加到声明中:

@NgModule({
  declarations: [
    ........,
    StripHTML
  ],
...
Run Code Online (Sandbox Code Playgroud)

现在当我试图在html模板中使用它时出错:

core.es5.js:1085 ERROR Error: Uncaught (in promise): …
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework ionic3 angular

17
推荐指数
2
解决办法
1万
查看次数

标签 统计

angular ×1

ionic-framework ×1

ionic3 ×1

typescript ×1