How to merge in javascript

I'm working on an ionic app using xmpp + strophejs so I created this getRoster function to get the current user's roster then use the jids to grab the vcards then merge them but i had one problem I wasnt sure how to do it. So i ended up using a $timeout function which i don't really like :(

var getRoster = function () {

        var deferred = $q.defer();

        var vCard = [];

        connection.roster.get(function (roster) {
            angular.forEach(roster, function (value,key) {

                    var iq = $iq({
                        type: 'get',
                        to: roster[key].jid
                    }).c('vcard', {xmlns: 'urn:ietf:params:xml:ns:vcard-4.0'});

                    connection.sendIQ(iq, function (data) {
                        vCard.push({
                            jid: roster[key].jid,
                            groups :roster[key].groups,
                            subscription : roster[key].subscription,
                            nickname:angular.element(data).find('vcard').find('nickname').text(),
                            photo: angular.element(data).find('vcard').find('photo').text().replace(':',':image/png')
                        })
                    });


            })


            $timeout(function () {
                deferred.resolve(vCard)
            },400)

        }, function (error) {
            deferred.reject(error)
        })


        return deferred.promise;
    }