【发布时间】:2020-07-29 12:42:10
【问题描述】:
getspacecol(){
this.gets=true;
this.selectedfeatures=[];
this.variantService.getData().subscribe((dat) => {
this.dataa = dat;
for(let i=0;i<this.selectedItems.length;i++)
{
this.tool=this.selectedItems[i].itemName;
}
console.log(this.tool);
for(let i=0 ; i<this.dataa.length;i++){
if(this.dataa[i].this.tool===this.searchResult.value)//error in this.tool
{
this.selectedfeatures.push(this.dataa[i]);
}
}
this.data=[...this.selectedfeatures];
});
}
大家好,我的表中有 200 列,并且 angular2 多选下拉列表包含 200 列作为下拉值。我在变量 selectedItems 中获得下拉选择值 在 if 条件下,如果我给出 this.dataa[i].stackover 则没有错误,因为 stackover 是列之一。下拉列表中存在相同的 stackover,并在选择时打印在 console.log 中。
现在我需要在 this.dataa[i].this.tool 的 if 条件中使用此变量,否则我将不得不为 200 列编写 if 条件 你们能帮我解决这个问题吗
【问题讨论】:
标签: javascript json angular typescript angular-observable