get the value from a FileReader in Angular 2
<p>I have the following component that load a file and bind his content as string</p>

<pre><code>    export class NgCsvComponent {

        @Input() csv: any;

        @Output() csvChange: any = new EventEmitter();

        public localCsv : any = '';

      constructor() { }

      changeListener($event): void {
        this.readFile($event.target);
      }

      readFile (inputValue : any) : void {
        let reader = new FileReader (),
              file : File = inputValue.files[0];
          reader.readAsText(file);    
        reader.onload = this.onLoadCallback;
      }

        onLoadCallback (event) {
            this.csvChange.emit(event.target["result"]);
        }
    }
</code></pre>

<p>the problem is that <code>this.csvChange</code>  is undefined inside <code>onLoadCallback</code> so how I could pass the result to some variable in my component? </p>

<p>I was search other similar <a href="https://stackoverflow.com/questions/30830268/how-to-make-filereader-work-with-angular2">question</a> but never get the result outside of onloadCallback function</p>