Search code examples
arraysangulararraylisttyposcript

Angular Array list .get method not working


I am trying to Check two Array list ( any = [] and FormArray) each array list has multiple items

Array 1 enter image description here

Array 2 enter image description here

I want to check UoMName and SubBaseUoMCode is equal

if I run this code

    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
    }

enter image description here

I am trying to fix this using (.at, .console). Any ideas?


Solution

  •        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
         
    
       }