Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 7b18499

Browse files
authored
chore: only accept CSV files
1 parent 81703ad commit 7b18499

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/examples/grid43.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ export class Grid43Component {
2121
constructor(private readonly cd: ChangeDetectorRef) {}
2222

2323
handleFileImport(event: any) {
24-
const file = event.target.files[0];
25-
if (file) {
24+
const file: File = event.target.files[0];
25+
if (file.name.endsWith('.csv')) {
2626
const reader = new FileReader();
2727
reader.onload = (e: any) => {
2828
const content = e.target.result;
2929
this.dynamicallyCreateGrid(content);
3030
};
3131
reader.readAsText(file);
32+
} else {
33+
alert('File must be a CSV file');
3234
}
3335
}
3436

0 commit comments

Comments
 (0)