I have a selection menu on my webpage that is essentially an unordered list, with each item in the menu formatted like this:
<li ng-click='doCalc(5)'>Five</li>
The doCalc
function that is triggered by clicking on these items may take some time to complete:
function doCalc(num) {
factorial(num);
}
As a result, the menu remains visible on the screen while the factorial
function executes. I would prefer for doCalc
to return immediately without waiting for factorial
to finish its execution.
I am familiar with achieving this using a delay-less setTimeout or a promise. However, I am curious about the best Angular approach to handle this scenario. Is there a specific Angular method to accomplish this task, rather than resorting to the more generic approaches?