Multiple Files Download Angular Js

0
603

Hello all, here is the code for achieving multiple download all files on one click.

JS Controller Function Code :-


    $scope.downloadAll = function()
    {
        console.log('networkImageDocumentList',$scope.networkImageDocumentList);
        angular.forEach($scope.networkImageDocumentList, function(value, key) {
            console.log('key',key);
            console.log('value',value);
            var a = document.createElement("a");
            a.setAttribute('href', './uploads/'+value.image_name);
            a.setAttribute('download', '');
            a.setAttribute('target', '_blank');
            a.click();
        });
    }

View File Code :-

 <a ng-click="downloadAll();">Download All Attachments</a>

LEAVE A REPLY

Please enter your comment!
Please enter your name here