Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angularjs $q all hash

// as an object
$q.all({
  one: $http.get('/url1'),
  two: $http.get('/url2')
}).then(function (results) {
  var data1 = results.one;
  var data2 = results.two;
});

// as an array
$q.all([
  $http.get('/url1'),
  $http.get('/url2')
]).then(function (results) {
  var data1 = results[0];
  var data2 = results[1];
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #angularjs #hash
ADD COMMENT
Topic
Name
8+2 =