Every time I run ng serve, it gives me a syntax error. It will indicate that something like ;, ), or , is missing. The strange thing is that if you remove one of these characters, save the code, and then run ng serve again, it will work perfectly. However, the next time you run ng serve, you will encounter a similar error and have to add back the character you removed last time in order for it to work again. Here is the problematic code snippet:
OnFileSelected(event) {
const file: File = event[0];
this.ReadAsBase64(file)
.then(result => {
this.selectedFile = result;
})
.catch (err => {this.error = err; setTimeout(() => {this.error = ''; }, 2000; } ); )
}
All these errors with , ; ) or }
are occurring here:
.catch (err => {this.error = err; setTimeout(() => {this.error = ''; }, 2000; } ); )
}
What is the solution to fixing this issue?