title: angularJS 1.4.0 Argument 'MainController' is not a function, got undefined
body: <pre><code> (function () {
  
      var app = angular.module("Sports", []);
      var MainController = function($scope, $http) {
  
          var onUser = function (response) {
              obj = JSON.parse(response);
              $scope.sport = angular.fromJson(obj);
          };
  
  
          $http.get("/api/SportApi/Get").success(function (response) {
              obj = JSON.parse(response);
              $scope.sport = angular.fromJson(obj);
          });
      };
      app.controller("MainController", ["$scope", "$http", MainController]);
  }());
  </code></pre>
  
  <p>So yeah, this script is not working, getting the error it can not find the "main controller as function" whats the problem?</p>
  
  <p>EDIT: 
  the error cause is in this function: </p>
  
  <pre><code> function consoleLog(type) {
    var console = $window.console || {},
        logFn = console[type] || console.log || noop,
        hasApply = false;
  
    // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
    // The reason behind this is that console.log has type "object" in IE8...
    try {
      hasApply = !!logFn.apply;
    } catch (e) {}
  
    if (hasApply) {
      return function() {
        var args = [];
        forEach(arguments, function(arg) {
          args.push(formatError(arg));
        });
        return logFn.apply(console, args); //throws exception
      };
    }
  </code></pre>