title: How to listen native and custom javascript events inside Angularjs
body: <p>I'm trying to get a native javascript event listener inside an AngularJs controller. I don't try to explain why but I cant' understand how to solve this.</p>
  
  <p>I've created the custom event like this:</p>
  
  <pre><code>var event = document.createEvent('HTMLEvents');
  event.initEvent('custom-event', true, true);
  document.dispatchEvent(event);
  </code></pre>
  
  <p>and inside the angular controller:</p>
  
  <pre><code>angular.module('uploadCtrl', [])
    .controller('uploadController', ['$scope', '$window', '$compile', function($scope, $window, $compile, $http, Video) {
      document.addEventListener('custom-event', function(e) {
        console.log('event received');
      })
    }]);
  </code></pre>
  
  <p>What I'm doing wrong?
  Thanks</p>