apycazo
6/4/2013 - 8:45 PM

Wait for several queries to complete

Wait for several queries to complete

function dataControler ($scope, $http, $q) {
  var names = $http.get("names.json"),
      dates = $http.get("dates.json"),
      options = $http.get("options.json");
  $q.all([names, dates, options]).then(function(arrayOfResults) { 
      // Callback called when all promised would be resolved
  });
}