title: TypeError when running Angular directive under electron?
body: <p>I get this exception trace:</p>
  
  <p>TypeError: element.get is not a function
      at link (<a href="http://localhost:9071/js/class-editor-canvas-directive.js:6:33" rel="nofollow">http://localhost:9071/js/class-editor-canvas-directive.js:6:33</a>)
      at invokeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:8841:9" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:8841:9</a>)
      at nodeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:8335:11" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:8335:11</a>)
      at compositeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:7731:13" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:7731:13</a>)
      at compositeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:7734:13" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:7734:13</a>)
      at publicLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:7611:30" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:7611:30</a>)
      at <a href="http://localhost:9071/bower_components/angular-ui-router/release/angular-ui-router.js:4026:9" rel="nofollow">http://localhost:9071/bower_components/angular-ui-router/release/angular-ui-router.js:4026:9</a>
      at invokeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:8841:9" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:8841:9</a>)
      at nodeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:8335:11" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:8335:11</a>)
      at compositeLinkFn (<a href="http://localhost:9071/bower_components/angular/angular.js:7731:13" rel="nofollow">http://localhost:9071/bower_components/angular/angular.js:7731:13</a>) </p>
  
  <p>I'm trying to run an app based on angular.js and paper.js under electron. It works fine running on the web and using chrome as the UI. However, I also want to support a standalone UI using an electron wrapper.</p>
  
  <p>The error above occurs on the last line below:</p>
  
  <pre><code>jModeller.directive('classEditor', function () {
  return {
      restrict: 'A',
      link: function (scope, element, attrs) {
  
          paper.setup(element.get(0));
  </code></pre>
  
  <p>When running on electron, the debugger reveals that the type of 'element' is:</p>
  
  <pre><code>element: JQLite[1]
     &gt; 0: canvas
     length: 1
  __proto__: Object[0]
  </code></pre>
  
  <p>But when running under chrome, the debugger shows the type of 'element' to be:</p>
  
  <pre><code>element: jQuery.fn.init[1]
     0: canvas
     context: canvas
     length: 1
  __proto__: jQuery[0]
  </code></pre>
  
  <p>Why the difference? And is there some expression I can use instead of element.get(0) to get this angular directive running under electron?</p>
  
  <p>=====</p>
  
  <p>Some more details. </p>
  
  <p>Here is the 'main.js' that is running under electron:</p>
  
  <pre><code>'use strict';
  
  var app = require('app');
  var BrowserWindow = require('browser-window');
  
  var mainWindow = null;
  
  var express = require('express');
  var expressApp = express();
  
  expressApp.use('/', express.static('../assets'));
  expressApp.listen(9071);
  
  app.on('ready', function() {
  mainWindow = new BrowserWindow({
      height: 600,
      width: 800
  });
  
  mainWindow.loadUrl('http://localhost:9071/#/');    
  });
  </code></pre>
  
  <p>So you can see I am serving up the application on port 9071, then just using electron to browse to that on localhost.</p>
  
  <p>Within the index.html, all the javascript libraries are loaded:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:ng="http://angularjs.org" class="no-js" lang="en" ng-app="jModeller" id="ng-app"&gt;
    &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
  
  &lt;script src="bower_components/jquery/dist/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular/angular.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/bootstrap/dist/js/bootstrap.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-resource/angular-resource.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-cookies/angular-cookies.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-sanitize/angular-sanitize.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-animate/angular-animate.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-touch/angular-touch.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-route/angular-route.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-ui-router/release/angular-ui-router.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-mocks/angular-mocks.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/ng-sortable/dist//ng-sortable.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-ui-select/dist/select.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/ng-tags-input/ng-tags-input.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/rfc6570/rfc6570.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-hal/angular-hal.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-slugify/angular-slugify.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/ng-table/dist/ng-table.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/moment/moment.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-moment/angular-moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-ui-tree/dist/angular-ui-tree.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-cache-buster/angular-cache-buster.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-prompt/dist/angular-prompt.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-breadcrumb/dist/angular-breadcrumb.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/highcharts/highcharts.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/highcharts/highcharts-3d.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/highcharts/modules/exporting.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/underscore.string/lib/underscore.string.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/underscore/underscore.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-aria/angular-aria.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/spin.js/spin.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-spinner/angular-spinner.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-toggle-switch/angular-toggle-switch.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-toastr/dist/angular-toastr.tpls.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-ui-utils/ui-utils.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-loading-bar/build/loading-bar.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-progress-arc/angular-progress-arc.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-highcharts-directive/src/directives/highchart.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-bootstrap-lightbox/dist/angular-bootstrap-lightbox.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-async-series/dist/angular-async-series.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-ui-grid/ui-grid.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/angular-local-storage/dist/angular-local-storage.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/ng-csv/build/ng-csv.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/ng-file-upload/ng-file-upload.min.js"&gt;&lt;/script&gt;
  &lt;script src="bower_components/paper/dist/paper-full.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Quite a lot of libraries, and certainly not all are needed. I just cut this list from another project I was working on. The problem seems to be though, that jquery does not get loaded correctly and made available to angular.</p>
  
  <p>I can see under the dev tools network tab though that 'jquery.js' is succesfully loaded with a 200 status, when index.html is loaded.</p>