如何使按钮作为输入类型文件

时间:2016-05-06 04:32:47

标签: javascript html css angularjs

我有一个按钮。它应该在按钮点击时充当文件上传。

<div id="Rectangle-541">
    <md-icon md-svg-src="./assets/images/csv.svg" class="ic_cloud_download_black_24px"></md-icon>
  <md-button class="Upload-CSV-from-mem">Upload .CSV From Memory</md-button>

</div>

1 个答案:

答案 0 :(得分:1)

看看这个

*
var jimApp = angular.module("mainApp",  []);

jimApp.controller('mainCtrl', function($scope){
  
  $scope.fileChanged = function(){
		angular.element('#fileUplaod').trigger('click');
  };
  
  $scope.profilePictureSelected = function(data){
    console.log(data.files[0]);
  };
});