Can you demonstrate how to make this code asynchronous with an example? 1) Retrieve the file using the $http.get function from the server 2) Read the file into an array 3) Process the data (rebuild it) 4) Display a progress bar for each action
Here is the current code:
$http.get(filename).success(function (data) {
words = data.split(/\n| /);
reBuild(words) //this operation takes at least 5 seconds
Process(words) //this operation takes at least 4 seconds
})
I would like to make this code asynchronous so that my thread does not freeze while reBuild and Process are being executed. Any suggestions on how to achieve this?