🥅 Error display in drag&drop component

timeline
Alix JEUDI--LEMOINE 1 week ago
parent 98c6559e58
commit 973c89f8b7

@ -39,6 +39,11 @@
/>
</div>
<!-- Message d'erreur -->
<div *ngIf="errorMessage" class="mt-2 text-sm text-red-600 dark:text-red-400">
{{ errorMessage }}
</div>
<!-- Zone pour afficher les fichiers sélectionnés -->
<div
*ngIf="fileNames.length > 0"

@ -15,6 +15,7 @@ import {
})
export class DragDropComponent implements OnChanges {
@Input() initialFiles: string[] = [];
@Input() errorMessage: string = '';
fileNames: string[] = [];
@Output() filesSelected = new EventEmitter<FileList>();
@Output() fileRemoved = new EventEmitter<string>();
@ -61,9 +62,8 @@ export class DragDropComponent implements OnChanges {
}
private updateFileNames(files: FileList): void {
for (let i = 0; i < files.length; i++) {
this.fileNames.push(files[i].name);
}
const newFileNames = Array.from(files).map(file => file.name);
this.fileNames = [...this.fileNames, ...newFileNames];
}
removeFile(fileName: string, event: Event): void {

Loading…
Cancel
Save