$http.get return a promise, so you can't return a result at the end of your function getDamageEvents, instead you should affect your result to a variable called damages in the success callback like this :