我正在尝试使用 html 5 上传文件,但似乎无法正常工作。
我试过这个
<input type="file" name ="file" accept="image/*" onchange="angular.element(this).scope().selectFileForUpload(this.files)" />
在组件内部我得到了这个方法:
public selectFileForUpload(file) {
console.log(file[0]);
}
使用上述代码时出现此错误:
settings:1 Uncaught TypeError:
angular.element(...).scope(...).selectFileForUpload is not a function
这适用于 angular 1.4 但不适用于 1.5.x 任何人有任何建议如何实现这一点?
我试图将 scope() 更改为 model 和 $ctrl 但也不起作用。