Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

323
Views
Angular: How to store FileReader content in a variable or an array

I'm so confused about this but is there a way to store FileReader content into a variable or an array as it is, because I need that content into another component.

This is my code snippet:

fileChangeListener($event: any): void {

        this.fileSize = Math.round($event.target.files[0].size /1024) + 'KB';
        this.fileName = $event.target.files[0].name;
        this.fileType = $event.target.files[0].type;
        this.filelastModifiedDate = new Date($event.target.files[0].lastModified).toLocaleDateString();

        console.log(this.fileName, this.fileType);

        console.log('submitted here');
        const file = $event.target.files[0];
        const fileReader = new FileReader();
        fileReader.onload = (e) => {
            const data = fileReader.result;
            this.storeResults(data);
            this._fileReader = data;
            // console.log('FileREAAAAAAAAAAADER \n', data);
            console.log(this._fileReader);
            this.parseData(data);
        };
        return fileReader.readAsText(file);
    }

component.html:

<mat-form-field (change)="fileChangeListener($event)">
                            <ngx-mat-file-input formControlName="multiplefile" placeholder="Multiple inputs" multiple></ngx-mat-file-input>
                            <mat-icon matSuffix>folder</mat-icon>
                        </mat-form-field>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!