I am trying to do something very basic in angular . The idea is to just read a log file and display the same in tabular format after processing it and filtering it.
I have completed the heroes tutorial. My project has just one component.
app.component.html
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
</div>
<app-maindisplay></app-maindisplay>
maindisplay.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-maindisplay',
templateUrl: './maindisplay.component.html',
styleUrls: ['./maindisplay.component.css']
})
export class MaindisplayComponent implements OnInit {
constructor() { }
ngOnInit() {
}
handleFile(InputFileList: FileList): void {
console.log('The Handle file got called');
}
}
maindisplay.component.html
<div style="text-align:left">
<input type="file" id="LogFileInput" onchange="handleFile(this.files)">
</div>
The file dialogue box comes up correctly.
However, when the file is selected on chrome console, following error message comes up.
Uncaught ReferenceError: handleFile is not defined at HTMLInputElement.onchange (localhost/:13)
Can you please help me fix this issue ? Once the function is called I would be able to handle the file manipulation.
Best Regards, Vinayak