Below is an asynchronous function that was designed to populate the userList
through the backend. However, when it is called using await this.getUsers();
within the ngOnInit
method, the userList
returns as an Observable. What crucial part seems to be missing here?
async getUsers(): Promise<void> {
if (this.empId) {
this.userList = await this.empService.getEmpUsers(this.empId);
console.log(this.userList); // return Observable {}
}
}