First off, I recently got back into web development after a couple year hiatus. I did a little work with angularjs, but now I switched over to Angular2.
My questions is how do I handle asynchronous js?? I've seen so many demonstrations and articles, but they never seem to apply to my situation. Right now, I am getting information from an API, converting the data into a usable array, and then doing some calculations based on that array (think of it as two functions, one right after the other). How do I handle that, specifically in an angular 2 world?
createArray(){
// Getting data from api (from service)
// Creating an array
// Returning array
}
calculations(){
// Doing calculations on the returned array
}
How do I get calculations to wait for createArray?