I am currenly using this package https://www.npmjs.com/package/angular-file?activeTab=readme to upload file , anyone has an idea how we can integrate a change event on this Drop Files where it will automatically call a method after the click browser and then opening a file ?
how do we call a method after a file was drop ? so that I would no longer need to add a button ang then click it , after the file is drop it should call the upload method.
<div ngfDrop
[(files)]="files"
[(file)]="file"
([validDrag])="validDrag"
([invalidDrag])="invalidDrag"
[ngClass]="{'myHoverClass': validDrag, 'myAntiHoverClass': validDrag}"
>
Drop Files Here
</div>
#ts code
uploadFile(payload:any) {
const formData: FormData = new FormData();
this.files.map((file) => {
formData.append('attachment', file, file.name);
});
this._inspectionService.uploadCSV(formData)
.pipe(debounceTime(500))
.subscribe(
res=>{
if(res.isSuccess){
}
},
err=>{
AppUtils.errorHandler(err,this._notificationService, this.dialog);
}
)
}