I am facing an unusual problem while trying to implement a file upload feature in my Angular application. The issue is that the event only gets triggered on the first click.
template
<input
multiple
type="file"
(change)="onFileSelected($event)"
id="file"
class="upload-box__btn__file-input"/>
<label class="upload-box__btn__file-label" for="file">Upload file from PC</label>
component
onFileSelected(event: Event) {
console.log(event)
const file = (event.target as HTMLInputElement).files[0];
// if (file.length >= 1) {
// this.fileToUpload = file;
// }
}