File Upload using AngularJS

前端 未结 29 2019
野趣味
野趣味 2020-11-21 07:24

Here is my HTML form:

29条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-21 08:10

    Use the onchange event to pass the input file element to your function.

    So when a user selects a file, you have a reference to it without the user needing to click an "Add" or "Upload" button.

    $scope.fileSelected = function (element) {
        var myFileSelected = element.files[0];
    };
    

提交回复
热议问题