Skip to content

Commit 1d40cbd

Browse files
authored
Merge pull request #480 from cal-smith/issue#451
fix(file-uploader) when multiple=false keep only the most recent file
2 parents 2788a03 + a4c531c commit 1d40cbd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/file-uploader/file-uploader.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ export class FileUploader implements OnInit {
144144

145145
onFilesAdded() {
146146
const files = this.fileInput.nativeElement.files;
147+
if (!this.multiple) {
148+
this.files.clear();
149+
}
147150
for (let file of files) {
148151
const fileItem: FileItem = {
149152
uploaded: false,

src/file-uploader/file-uploader.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FileUploaderStory {
3535
static notificationCount = 0;
3636

3737
@Input() notificationId = `notification-${FileUploaderStory.notificationCount}`;
38-
@Input() files: any;
38+
@Input() files = new Set();
3939
@Input() title;
4040
@Input() description;
4141
@Input() buttonText;

0 commit comments

Comments
 (0)