Skip to content

Instantly share code, notes, and snippets.

@vpascual
Created August 2, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpascual/802858c129d8f7ecbca2 to your computer and use it in GitHub Desktop.
Save vpascual/802858c129d8f7ecbca2 to your computer and use it in GitHub Desktop.
'use strict';
angular.module('solrExplorerApp')
.factory('SolrRequester', function ($q, $http) {
return function(queries) {
var promises = queries.map( function(file) {
var deffered = $q.defer();
$http({
url : file,
method: 'GET'
})
.success(function(data){
deffered.resolve(data);
})
.error(function(error){
deffered.reject();
console.log("Solr returneed error: " + error)
});
return deffered.promise;
})
return $q.all(promises);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment