Friday, April 12, 2019

TypeError: Object doesn't support property or method 'includes'

This error shows up in Edge but not Chrome so I guess I should not use .includes eh? This...

private getBusinessUnitRecordsSuccess(records:Array<BusinessUnitRecordModel>){
   records.forEach(r => {
      if (this.user.BusinessUnitIds.includes(r.BusinessUnitID)){
         this.businessUnitRecords.push(r);
      }
   });
}

 
 

...should become:

private getBusinessUnitRecordsSuccess(records:Array<BusinessUnitRecordModel>){
   records.forEach(r => {
      this.user.BusinessUnitIds.forEach(i => {
         if (i === r.BusinessUnitID) {
            this.businessUnitRecords.push(r);
         }
      });
   });
}

No comments:

Post a Comment