title: AngularJS refreshing page intermittently throws an uncaught object
body: <p>I currently have a routes file that is loading a controller and partial html when it hits the index. I am using the http-server with default configuration that comes with the angular-seed project. So I am starting the server using npm start.</p>
  
  <p>The problem is that the first time I hit the page right after I start the server, the page seems to be loading fine. But if I sit there and refresh the page a bunch, I start to get an uncaught object error that looks like this,</p>
  
  <pre><code>Uncaught object angular.js:78
      (anonymous function) angular.js:78
      (anonymous function) angular.js:3948
      forEach angular.js:320
      loadModules angular.js:3909
      createInjector angular.js:3849
      doBootstrap angular.js:1510
      bootstrap angular.js:1525
      (anonymous function) app.js:12
      n.Callbacks.j jquery.js:3073
      n.Callbacks.k.fireWith jquery.js:3185
      n.extend.ready jquery.js:3391
      I jquery.js:3407
  </code></pre>
  
  <p>app.js</p>
  
  <pre><code>"use strict";
  
  define("app", ["angular", "routes", "angular-resource", "angular-route", "jQuery"], function (angular) {
      var app = angular.module("app", [
          "ngResource", 
          "ngRoute", 
          "app.customerApp"
      ]);
  
      angular.element().ready(function() {
          angular.bootstrap(document, ["app"]);
      });
  
      return app;
  });
  </code></pre>
  
  <p>routes.js</p>
  
  <pre><code>"use strict";
  
  require(["app", "components/app/app-ctrl", "components/customer/customer-ctrl"], function(app) {
      return app.config(["$routeProvider", "$resourceProvider", 
      function ($routeProvider, $resourceProvider) {
          $routeProvider.when("/", {
              controller: "CustomerCtlr", 
              templateUrl: "/app/partials/customer.html"
          }).otherwise({redirectTo: '/'});
      }]);
  });
  </code></pre>
  
  <p>customer-ctrl.js</p>
  
  <pre><code>'use strict';
  
  define("customerApp", ["angular", "angular-resource"], function(angular) {
      var customerApp = angular.module('app.customerApp', ["ngResource"]);
      return customerApp;
  });
  
  require(["customerApp"], function(customerApp) {
      customerApp.controller("CustomerCtlr", ["$scope", function ($scope) {
  
      }]);
  });
  </code></pre>
  
  <p>I have found out by putting in console.logs in the app.js, routes.js, and the controller that they are loading in different orders every time. Why is this happening? RequireJS is supposed to be preventing that.</p>