title: Angular controller returned undefined
body: <p>I'm working with a legacy VB.Net app I inherited. The ng-app and ng-controller directives both appear on the HTML element in the root master page:</p>
  
  <pre><code>&lt;html runat="server" id="html" ng-controller="MasterController"&gt;
  </code></pre>
  
  <p>The <code>ng-app</code> attribute is set in the code-behind for the page. It's present when I run the page and view the source. The app is scoped to the module <code>ng-app="myModule"</code></p>
  
  <p>The controller is defined in a function passed to <code>add_load</code> in the masterpage also, not quite at the end of the body, but not far from it:</p>
  
  <pre><code>Sys.Application.add_load(function () {
  
          var module = angular.module('myModule');
          var MasterController = function ($scope, $compile) {
              ... // stuffs
              }
          };
  
          module.controller('MasterController', ["$scope", "$compile", MasterController]);
  
      });
  </code></pre>
  
  <p>Locally, this works (or seems to work) fine, I see no errors in the console. However, the app has now been deployed to a staging environment, and in the browser console in that environment I see an Angular error:</p>
  
  <blockquote>
    <p>[ng:areq] not a function got undefined</p>
  </blockquote>
  
  <p>There are very few differences between the staging area and my local environment, these differences are largely that the .Net script bundler is used to concatenate and minify a bunch of JS files, including Angular, and the data used by the app. AFAIK there are no other differences.</p>
  
  <p>I don't think the bundler is causing the issue as I enabled bundling locally and I don't see the error. I also can't see that the data passed to the app is causing the problem (it's customer data, account data, etc) as it's not even used in this particular controller.</p>