AngularJS download multiple files from checkbox -


i'm quite new angularjs , have come across problem. have checkbox user can select checkboxes download files. user can click on button download selected files. think it's quite simple can't make work. when select checkboxes first file in array downloaded. think need loop through array, i'm doing wrong. please if make suggestions/or grateful. thank you.

here download button in html:

<button type="submit"          ng-click="download()"          ng-disabled="myform.$invalid"          class="btn btn-success"> <span class="glyphicon glyphicon-download-alt"></span>&nbsp;download</button>   

and in controller:

 $scope.download = function() {         $http.get("http://localhost:3000/download?"+ $scope.selection)         .success(function (data, status, headers, config) {             angular.foreach($scope.results, function (result) {               $scope.download.push("result.personname"+"result.&userid");                 //alert("downloaded!")              });          });       }; 

i hope $scope.selection array, want download.

$scope.download = function() {    angular.foreach($scope.selection, function (value, key) {         $http.get("http://localhost:3000/download?"+ value)       .success(function (result, status, headers, config) {          $scope.downloadarray[key] = "result.personname"+"result.&userid";       });    }); }; 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -