Angular 数组列表 .get 方法无效
Angular Array list .get method not working
我正在尝试检查两个数组列表(any = [] 和 FormArray)每个数组列表都有多个项目
数组 1
数组 2
我想检查 UoMName 和 SubBaseUoMCode 是否相等
如果我运行这个代码
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i].get('UoMName'));
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails.value[i2].get('UoMName'));
if (this.UOMList[i].get('UoMName') == this.BaseUoMDetails.value[i2].get('SubBaseUoMCode') ) {
console.log("checked");
}
}
debugger
}
我正在尝试使用 (.at, .console) 解决此问题。有什么想法吗?
要访问数组 UOMList
和 BaseUoMDetails
中的 属性 UoMName
,您必须稍微更改代码。试试下面的代码=>
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i].get('UoMName'));
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails[i2]['UoMName']);
if (this.UOMList[i].get('UoMName') == this.BaseUoMDetails[i2]['SubBaseUoMCode'] ) {
console.log("checked");
}
}
//debugger
}
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i]['UoMName']);
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails.value[i2]['UoMName']);
if (this.UOMList[i]['UoMName'] == this.BaseUoMDetails.value[i2]['SubBaseUoMCode'] ) {
console.log("checked");
}
}
debugger
}
我正在尝试检查两个数组列表(any = [] 和 FormArray)每个数组列表都有多个项目
数组 1
数组 2
我想检查 UoMName 和 SubBaseUoMCode 是否相等
如果我运行这个代码
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i].get('UoMName'));
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails.value[i2].get('UoMName'));
if (this.UOMList[i].get('UoMName') == this.BaseUoMDetails.value[i2].get('SubBaseUoMCode') ) {
console.log("checked");
}
}
debugger
}
我正在尝试使用 (.at, .console) 解决此问题。有什么想法吗?
要访问数组 UOMList
和 BaseUoMDetails
中的 属性 UoMName
,您必须稍微更改代码。试试下面的代码=>
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i].get('UoMName'));
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails[i2]['UoMName']);
if (this.UOMList[i].get('UoMName') == this.BaseUoMDetails[i2]['SubBaseUoMCode'] ) {
console.log("checked");
}
}
//debugger
}
for (let i = 0; this.UOMList.length > i; i++) {
console.log( this.UOMList[i]['UoMName']);
for (let i2 = 0; this.BaseUoMDetails.length > i2; i2++) {
console.log(this.BaseUoMDetails.value[i2]['UoMName']);
if (this.UOMList[i]['UoMName'] == this.BaseUoMDetails.value[i2]['SubBaseUoMCode'] ) {
console.log("checked");
}
}
debugger
}