In my Ionic code snippet, I have the following function defined in a factory:
.factory('resultsFactory', function($http, $q, $rootScope, $firebaseArray, $timeout) {
var results = {};
function _all(){
var d = $q.defer();
var palabras = $rootScope.textAreaOfrecer.toLowerCase().split(' ');
var solicitudes = [];
Promise.all(
solicitudes = palabras.map(palabra => $firebaseArray(firebase.database().ref().child("solCompras").orderByChild("palabras/"
+ palabra).equalTo(true) ) )
);
var array = [].concat.apply([],solicitudes);
d.resolve(array);
return d.promise;
}
results.all = _all;
return results;
})
However, when executing the line of code:
var array = [].concat.apply([],solicitudes);
, it's returning an empty array.