pIvan / file-upload

drag and drop file component
MIT License
87 stars 12 forks source link

Detect Event when delete element #74

Closed joseserrano15 closed 1 year ago

joseserrano15 commented 2 years ago

How can I detect when an element from the list is deleted? or when the span is clicked? I Use template-driven form

image

pIvan commented 2 years ago

Hi @joseserrano15,

currently that is not possible if you use angular template-driven form, but it can be if you use it with FileUpload Control instance. Here is example of it.

class: `public readonly fileUploadControl = new FileUploadControl();

constructor() { this.fileUploadControl.discardedValueChanges.subscribe((files: File[]) => { console.log(deleted files:, files) }) } `

html: <file-upload [(ngModel)]="fieldName" [control]="customFileUploadControl"></file-upload>

joseserrano15 commented 2 years ago

It worked perfectly! Thank you.