use $q.all to wait for all requets to finish and then do stuff with the data