title: Using ArangoJS Driver in Angular2 Web Application
body: <p>I am working on a project using Angular2 and Typescript (v1.8.10). We want to integrate data from an ArangoDB database into the web application. I would like to use the arangojs driver if possible. As typings for the arangojs module do not exist yet (if they do exists can someone point me to them?) I am attempting to use the allowJs tsc compiler option. Everything transpiles fine however systemjs is unable to load the arangojs module. The following line in my ts file (outside of any class definition):</p>
  
  <pre><code>let arangojs = require("arangojs");
  </code></pre>
  
  <p>transpiles to:</p>
  
  <pre><code>var arangojs = require("arangojs");
  </code></pre>
  
  <p>however when I load my web application this require("arangojs") generates the following error:</p>
  
  <pre><code>(index):48 Error: (SystemJS) SyntaxError: Unexpected token &lt;
  </code></pre>
  
  <p>Any advice or suggestions regarding how to use the arangojs driver in an Angular2 web application is welcome.</p>
  
  <p>Thanks</p>
  
  <p><strong>Update</strong></p>
  
  <p>I found the error noted above. The error was due to a typo in my system.config.js. After fixing the typo the module failed to load due to errors loading the arangojs dependencies such as http, https, querystring, and many more. I am speculating that the module loader used behind the scenes  by require is incompatible with systemjs used by Angular2. I was able to load the minified arangojs driver via </p>
  
  <pre><code>&lt;script src="arangojs.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and then use</p>
  
  <pre><code>declare var arangojs : any 
  </code></pre>
  
  <p>in my typescript file.  I would prefer to use arangojs natively in the typescript environment though. Has anyone used the arangojs driver in an Angular2 typescript environment (rather than the hack i described above) and if so how did you get it to work?</p>
  
  <p>Thanks again.</p>