angular - Can I call a Pipe from a Pipe in Angular using Typescript?
问题描述
I'm new to this Angular and Typescript world. I´m currently struggling with the following pipe code: There is already a pipe that checks if object.struktur.id
should be enabled or not. Now I have to do it with a loop. I literally just copied the code from the other pipe and changed the value to 'i' so that it can iterate.
and I don't know why this is not working.. that's why Im wondering if i can directly call the other pipe from this pipe and give the object[i].struktur.id
as parameter. is this possible?
transform(group: any[]): boolean {
let probe;
for(let i=0; i<group.length;i++){
combineLatest([
this.iqsService.darfBogenBearbeiten$,
this.iqsService.enabledStateInbearbeitung$.pipe(
map(enabledState => enabledState[group[i].struktur.id] != null ? enabledState[group[i].struktur.id] : true),
distinctUntilChanged()
),
this._erhebungsService.istArchivierteErhebung$
]).pipe(
map(([darfBearbeiten, strukturEnabled, istArchivierteErhebung]) => {
if (!darfBearbeiten || istArchivierteErhebung) {
probe= false;
}
probe= strukturEnabled;
})
);
}
return probe;
}
解决方案
是的,您可以在其他管道中调用管道,只需启动管道并在其上调用转换
let pipe = new YourPipeClass();
let newValue = pipe.transform(value, args);
推荐阅读
- postgresql - 回避可能的分隔符冲突
- jwt - 如何设置公钥以从 Keycloak 验证 JWT 令牌?
- liclipse - LiClipse 深色编辑器颜色(黄底白字)
- winforms - 删除 WinForm 上的 1px 边框
- javascript - 想用正则表达式去除字符串中的一部分
- symfony - 纱线安装太多库
- tsql - 在数据访问模式下使用 SQL 命令时在 OLE DB 目标中出现映射错误
- apache-spark - 如何在java中序列化对象?将 graphhopper.mapmatching 重写为 spark
- git - GIT 文件即使在删除后仍保留在历史记录中
- python - 遍历一个 JSON 文件以查看 Python 中是否存在数字“2017”