I am trying to wrap my head around promises and have some issues. I have a JSON array consisting of many entries:
  { "Work Date"  : "08/04/2021"
  , "Work type"  : "Working"
  , "Project"    : "Projectname"
  , "Client"     : "Company"
  , "Employee"   : "John Doe"
  , "Work hours" : "2.5"
  , "Work note"  : "Work notations here"
  , "Task"       : ""
  , "Task Name"  : ""
  , "TaskType"   : ""
  },
In particular am interested to extract the employees to an array. So I can present / format easier. This is my dataProvider Service (Angular) which loads the JSON and provides the data for further usage:
export class DataproviderService {
  effortsList:Effort[]
  employeeList:string[]
  constructor(private http: HttpClient) { }
  getData(){
    return this.http.get<any>("assets/data.json")
    .toPromise()
    .then(res => <Effort[]>res.data)
    .then(data => { 
      data.forEach(employee => this.employeeList.push(employee["Employee"]))
      return this.effortsList = data.slice();
     })
  }
}
Unfortunately this is not working as I imagined. I get an uncaught error:
Uncaught (in promise): TypeError: this.employeeList is undefined
What am I doing wrong? Thank you in advance!
 
     
     
    