title: initialize angular on window.onload
body: <p>How can i make my angular app work when running the angular initialisation code in the window onload event</p>
  
  <p>PS : the code in comment works, the code in the onload event doesn't...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script src="http://apps.bdimg.com/libs/angular.js/1.4.0-beta.4/angular.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="style.css" /&gt;
      &lt;!--script&gt;
       angular.module('dropboxApp', [])
              .controller('dropboxController', function () {
                  var dropbox = this;
                  dropbox.label = 'hello angular';
              });
      &lt;/script--&gt;
      &lt;script type="text/javascript"&gt;
        window.onload=function() { 
        angular.module('dropboxApp', [])
              .controller('dropboxController', function () {
                  var dropbox = this;
                  dropbox.label = 'hello angular';
              });}
        &lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;div ng-app="dropboxApp" ng-controller="dropboxController as dropbox"&gt;
      {{dropbox.label}}
      &lt;/div&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>