After a user selects an employee, I trigger an asynchronous request to the server in order to retrieve the employee's events. In case the user tries to assign a task to the selected employee before receiving the event list from the server, I must postpone that assignment until the event data is available. The event list retrieval process involves using $http.get()
, which results in a promise being generated for further processing. However, there is a possibility that this promise has already been resolved, potentially resulting in an empty array as the event list. This complicates the decision-making process as I cannot simply rely on the contents of the array to determine if the promise has been fulfilled.
If I attach a .then function to a promise that has already been resolved, will it be executed immediately?