Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sweet警报后的文件上载窗口_Javascript_Html_Angularjs_Sweetalert - Fatal编程技术网

Javascript Sweet警报后的文件上载窗口

Javascript Sweet警报后的文件上载窗口,javascript,html,angularjs,sweetalert,Javascript,Html,Angularjs,Sweetalert,用例: 我正在尝试将窗口.警报更改为甜蜜警报 当我使用window.alert时,文件上传窗口前会出现一个警报弹出窗口,然后单击“确定”,文件上传窗口就会出现 但是,将window.alert更改为Sweet alert后,文件上载窗口同时出现。 当用户单击标签时,会显示Sweet alert,然后用户可以选择该文件 uploadAlert(): $scope.uploadAlert = function() { $window.alert(~~~~~~); } 如何

用例:

  • 我正在尝试将
    窗口.警报
    更改为甜蜜警报

  • 当我使用window.alert时,文件上传窗口前会出现一个警报弹出窗口,然后单击“确定”,文件上传窗口就会出现

  • 但是,将
    window.alert
    更改为Sweet alert后,文件上载窗口同时出现。
    
    
当用户单击标签时,会显示Sweet alert,然后用户可以选择该文件


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"/>
现在,您可以使用id以编程方式单击
,在关闭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();
     });
  }); 
}

是否在UI中显示给用户?是的,这是用户的视图我的意思是显示给用户的标签或Choosefile按钮,或者两者都可见?仅显示标签。我用CSSThanks隐藏文件输入!但是我应该在
ng单击中使用
$event
而不是
event
 $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();
     });
  }); 
}