title: Angular filereader onloadend return result
body: <p>In Angular, I have the following code which records audio, get the blob, and converts it to base64, using FileReader. But I'm not able to return this base64 data from onloadend method of file reader</p>
  
  <pre><code>  getRecordedAudio() {
      if (this.recordedAudio) {
        let fileReader = new FileReader();    
        fileReader.onloadend = function() {
          let base64data = fileReader.result;
          console.log('base64data-', base64data);
          // how to return here?
        };
        fileReader.readAsDataURL(this.recordedAudio);
      }
    }
  </code></pre>
  
  <p>How can I do this using either <code>callback</code> or <code>.then</code>? Or any other way?</p>