I want to wait until all my promises should finish

console.log("started");

            var promises = [];
            for (var i = 0; i < 10; i++)
            {               
                var promise = $http({ method: "GET", url: 
"http://maps.googleapis.com/maps/api/geocode/json?latlng=17.255155,78.15485445&sensor=true";
 
});
                promises.push(promise);
            }

$q.all(promises).then(function (result) {

console.log("all are done");

            });


console.log("end");


output getting:

started
end
all are done

My expected output is:

started
all are done
end

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to