0
<tr *ngFor="let logDetails of logDetails | search : term" >
管和组件之间的通信,我有,我想用一个变量的管道。在我的组件中定义了相同的变量。我如何将这个值从Component传递给Pipe?
//Pipe Structure
transform(value, [term], newVal) {
if (value == undefined && newVal == undefined) {
return undefined;
} else {
return value.filter((item) => item.LogString.startsWith(term));
}
}
//Component Structure
newVal(a) {
this.newChildData = a;
console.log(this.newChildData);
}
我想通过组件的newChildData
到管newVal
。
// HTML模板
当您调用管道时,通过模板将其传入。参数包含在文档中:https://angular.io/docs/ts/latest/guide/pipes.html – jonrsharpe
谢谢jonrsharpe。但我不是通过模板发送newVal。有一些“术语”字段,我正在从文本框中发送。 – user3856563
是的,我说你需要发送它需要的其他参数! RTFM。 – jonrsharpe