我们说我有一个pipeVar,它可以是任何管道,例如:number,uppercase,customPipe等
是否有一种简单的方法可以调用类似
的内容df1.groupby('bar').filter(lambda x: ((x.foo >= lower_bound) & (x.foo <= upper_bound)).all())
# bar foo
#0 001 -1
#1 001 0
#2 001 2
#3 001 3
#6 003 0
#7 003 1
#8 003 2
或某些特殊语法,如
{{ myVal | pipeVar }}
到目前为止,我发现的最接近的是Dynamic pipe in Angular 2
答案 0 :(得分:0)
我有更新plunkr plunkr link
像这样改变动态管道。
const dynamicPipe = "";
//i have give one simple logic for example if your dynamic pipe is like
this.dynamicPipe = ['number','uppercase','customPipe']; //pipe,pipe1 ... pipeN
//now create a one variable like 'number' | 'uppercase' | 'customPipe'
for (let i=0;i<this.dynamicPipe.length;i++){
dynamicPipe = dynamicPipe + " | "+this.dynamicPipe[i];
}
@Component({
selector: 'dynamic-comp',
template: '{{ data ' + dynamicPipe + '}}'
})