title: AngularJS exceptions during app loading
body: <p>I'm getting the following exceptions and I have no clue why </p>
  
  <pre><code>Exception #1
  Uncaught ReferenceError: $window is not defined directives.js:746
  (anonymous function) directives.js:746
  </code></pre>
  
  <p>The directive is very simple:</p>
  
  <pre><code>App.directive('diName', ['$window', function($window) {...}])
  
     Exception #2
      Error: [ng:areq] http://errors.angularjs.org/1.2.1/ng/areq?p0=AppCtrl&amp;p1=not%20a%20function%2C%20got%20undefined
              at Error (&lt;anonymous&gt;)
              at bower_components/angular/angular.min.js:6:447
              at bower_components/angular/angular.min.js:18:250)
              at bower_components/angular/angular.min.js:18:337)
              at bower_components/angular/angular.min.js:62:72
              at bower_components/angular/angular.min.js:49:117
              at p bower_components/angular/angular.min.js:7:361)
              at B bower_components/angular/angular.min.js:48:492)
              at h bower_components/angular/angular.min.js:43:24)
              at h bower_components/angular/angular.min.js:43:41) angular.js:9101
          (anonymous function) angular.js:9101
          (anonymous function) angular.js:6706
          g.$apply angular.js:11678
          (anonymous function) angular.js:1285
          d angular.js:3616
          Xb.c angular.js:1283
          Xb angular.js:1297
          xhrCallback home:10
  
  
          Uncaught Error: [ng:btstrpd] http://errors.angularjs.org/1.2.1/ng/btstrpd?p0=document MINERR_ASSET:20
  </code></pre>
  
  <p>Doing manual bootstrap as follows:</p>
  
  <pre><code>&lt;script&gt;
      angular.element(document).ready(function () {
        function xhrCallback() {
  
          &lt;some XHR Processing Here&gt;
  
          angular.module('App', []).value('X', &lt;X-value&gt;);
          angular.module('App', []).value('Y', &lt;Y-value&gt;);
  
          angular.bootstrap(document, ['App']);
        };
  
        &lt;XHR request here&gt;
  
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>NOTE:  sometimes the app loads fine...so seems like some timing issue?</p>