0
私のコードを実行すると、コンソールで "プロパティの '' undefined 'を置き換えることができますが、何とか" replace() "がその仕事をします。angle4のパイプで未定義のプロパティ 'replace'を読み取ることができません
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'questionPipe'
})
export class QuestionPipePipe implements PipeTransform {
public pattern: RegExp = /<question id=(.*?)><\/question>/g;
transform(value: string): string {
let newValue = value.replace(this.pattern, "________");
return newValue;
}
}
どのようにhtmlでパイプを使用していますか? 'value | questionPipe'である必要があります –
同じ問題、文字列引数で呼び出されている他のメソッドのみ –