title: addEventListener return value in AngularJS controller
body: <p>I have the following function in the controller: </p>
  
  <pre><code>    vm.trasformaController = function(){
  
                      document.getElementById("document")
                          .addEventListener("change", handleFileSelect, false);
  
  
                      function handleFileSelect(event) {
                          readFileInputEventAsArrayBuffer(event, function(arrayBuffer) {
                              mammoth.convertToHtml({arrayBuffer: arrayBuffer})
                                  .then(displayResult)
                                  .done();
                          });
                      }
  
                      function displayResult(result) {
  
                           var stringa = result.value;
                           console.log(stringa);
                           /*vm.risultato = stringa;*/
                           return stringa;
                  /*        document.getElementById("output").innerHTML = result.value;
  
                          var messageHtml = result.messages.map(function(message) {
                              return '&lt;li class="' + message.type + '"&gt;' + escapeHtml(message.message) + "&lt;/li&gt;";
                          }).join("");
  
                          document.getElementById("messages").innerHTML = "&lt;ul&gt;" + messageHtml + "&lt;/ul&gt;";*/
  
                      }
  
                      function readFileInputEventAsArrayBuffer(event, callback) {
                          var file = event.target.files[0];
  
                          var reader = new FileReader();
  
                          reader.onload = function(loadEvent) {
                              var arrayBuffer = loadEvent.target.result;
                              callback(arrayBuffer);
                          };
  
                          reader.readAsArrayBuffer(file);
                      }
  
                      function escapeHtml(value) {
                          return value
                              .replace(/&amp;/g, '&amp;amp;')
                              .replace(/"/g, '&amp;quot;')
                              .replace(/&lt;/g, '&amp;lt;')
                              .replace(/&gt;/g, '&amp;gt;');
                      }
  }
  </code></pre>
  
  <p>how can I return the <code>stringa</code> variable in my controller? I tried with <code>vm.result = stringa;</code> but this doesn't works. Any suggestions is appreciated. The console.log shows that my variable exists.</p>