title: Call typescript function from javascript code
body: <p>Due to limitations of IE10 and below, I have to recreate the Import/Upload functionality that I created since <code>FileReader</code> is not supported. I decided to use iFrame to meet the requirement to be able to upload using old browser.</p>
  
  <p>My form:</p>
  
  <pre><code>&lt;form id="file_upload_form" method="post" enctype="multipart/form-data" action="upload.php"&gt;
      &lt;input name="file" id="file" size="27" type="file" /&gt;&lt;br /&gt;
      &lt;input type="submit" id="import" value="Import" /&gt;&lt;br /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My javascript. I didn't finish the javascript code snippet because I realized that I had to do bigger rework if I call the action directly.</p>
  
  <pre><code>$('#import').click(function () {
      $('#imageForm').submit();
  
      $('#iFrameImage').load(function () {
          $('#file').val('');
          $.get('ImportExportController/Put');
      });
  });
  </code></pre>
  
  <p>See code below that the action in my controller is being called by typescript. Previously, I can just use <code>ng-click</code> then call this method.</p>
  
  <pre><code> public Import(xml, parentNode): restangular.IPromise&lt;any&gt; {
          var vr = {
              IsOk: false,
              Data: [xml, somethinghere],
              Errors: []
          };
          return this.restangular.one('Import', '0').customPUT(vr);
      }
  </code></pre>
  
  <p>I need this typescript function (which is my viewmodel as angular) to be called using javascript and unfortunately I have no idea how.</p>
  
  <p>The concept is to be able to upload a file via iFrame then on Upload is to call the Typescript function.</p>