甜蜜警报后文件上传 window

File upload window after Sweet Alert

用例:

当用户点击标签时,Sweet-alert出现,然后用户可以select文件。


uploadAlert() :

$scope.uploadAlert = function() {
        $window.alert(~~~~~~);
}

如何解决这个问题?

 <label for="ScanFile"><i class="fa fa-upload" style='cursor: pointer;' ng-click="uploadAlert(event, row)"></i></label>
 <input id="ScanFile" type="file"/>

您的 uploadAlert() 函数将类似于,

$scope.uploadAlert = function(e) {
    e.preventDefault(); // this will prevent the upload dialog from opening
    swal(); // sweetalert popup
}

现在您可以使用 id 以编程方式单击 <input id="ScanFile" type="file"/>,以在关闭 sweetalert 对话框后打开对话框。

 document.getElementById("ScanFile").click();

例如:

 $scope.uploadAlert = function(e) {
    e.preventDefault(); // this will prevent the upload dialog from opening
       swal({
      title: 'Demo',
      text: 'Demo',
      showCancelButton: true,
      confirmButtonText: 'Submit',
      },
      function() {
         document.getElementById("ScanFile").click();
     });
  }); 
}