Consider this code:
angular.module('app', [])
.controller('MainCtrl', function ($scope) {
...
});
I know that to avoid problems with injection when the JS is minified, the array form of Dependency Injection should be used:
angular.module('app', [])
.controller('MainCtrl', ['$scope', function ($scope) {
...
}]);
But how does Angular know in the first case (non-array) what to inject? What if I use .controller('MainCtrl', function (scop)
instead of $scope
? Does it parse my JS and look for function parameter names that match some of its providers?