My team and I are new to Angular and we are facing a challenge with invoking methods in sequence and returning a value. The issue is that the return statement is being executed before the completion of the execution process. We have tried various approaches such as async/await, promises, setTimeout but have not been successful. Is there a solution available for ensuring synchronous order in Angular?
transform(input:any)
{
this.getCachedUsers(); // This method sets the CachedUsers array using an HTTP GET call (subscribe)
this.getUserFromCachedUsers(input); // This method sets the userName based on the input userID from CachedUsers
return this.userName; // At this point, it's returning empty
}