title: Can't lazy load controllers in angular with oc.lazyLoad - controller not found
body: <p>I want to use lazy loading in my Angular project:</p>
  
  <p>This is the relevant app.js code:</p>
  
  <pre><code>var app = angular.module('eva', ['ui.router',
    'controllers', 'oc.lazyLoad']);
  
  app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', '$ocLazyLoadProvider',
    function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider, $ocLazyLoadProvider) {
      $httpProvider.interceptors.push('AuthInterceptor');
  
  
      $urlRouterProvider.otherwise("/");
      $locationProvider.hashPrefix('!');
  
      $stateProvider.state('challenge', {
        url: '/challenges',
        templateUrl: 'views/Challenges.html',
        controller: 'ChallengeCtrl',
        onEnter: ['$state', 'auth', function($state, auth) {
          if (!auth.isLoggedIn()) {
            $state.go('login');
          }
        }],
        resolve: { // Any property in resolve should return a promise and is executed before the view is loaded
          loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
            // you can lazy load files for an existing module
            return $ocLazyLoad.load('js/controllers/ChallengeController.js');
          }]
        }
  </code></pre>
  
  <p>This is my controller definition code:</p>
  
  <pre><code>angular.module('eva').controller('ChallengeCtrl', ['$scope', 'auth','$translate', 'challengeFactory', 'userFactory', 'userService',
    function($scope, auth, $translate, challengeFactory, userFactory, userService) {
  </code></pre>
  
  <p>I am not loading the challengecontroller.js file in the index.html file.</p>
  
  <p>I include oclazyload just before app.js in the index.html file:</p>
  
  <pre><code>&lt;script type="text/javascript" src="js/lib/oclazyload/dist/ocLazyLoad.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/app.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I get this error now when I run the app:</p>
  
  <pre><code>Error: [ng:areq] http://errors.angularjs.org/1.4.7/ng/areq?p0=ChallengeCtrl&amp;p1=not%20a%20function%2C%20got%20undefined
  </code></pre>
  
  <p>I tried many things for lazy loading, none of them worked. Now I just followed the example on <a href="https://github.com/ocombe/ocLazyLoad/blob/master/examples/complexExample" rel="nofollow">Example</a></p>
  
  <p>I really am in a pickle here, and I have no clue what to do to get the lazy loading working. I rather not work with requirejs.</p>