I have a question regarding architectural practices.
When defining an Angular module, one common approach is to do it like this:
angular.module('app', [])
.controller('Ctrl', ['$scope', function Ctrl($scope) {
//body...
}]);
However, I find the syntax a bit confusing. What if we structured the dependencies in an array, similar to AMD:
angular.module('app', [])
.controller('Ctrl', ['$scope'],
function Ctrl($scope) {
//body...
});
In this way, each element in the array refers to a specific module, matching the parameters of the function. It's almost like using arguments
.
So, my question is: why did the Angular designers choose the current convention instead?