1 添加文件输入框
<input type="file" id="uploadFile" ng-model="upFile" onchange="angular.element(this).scope().setFile(this)" />
2 在控制器中创建setFile方法
$scope.setFile = function (element) {
$scope.uploadedFile = element.files[0];
}
如上所述,我使用这种方式上传文件,它在 FireFox 中有效,但在 IE9 中显示“元素为空,我们未定义”。我能做些什么?