I have a question for the angularjs folks here.
So, I am using angular for quite a while now. However, every time when I am writing a new Controller or something that is using dependency injection, I find myself miswriting the the inline definition.
someModule.controller('MyController', ['dep1', 'dep2', function (dep1, dep2) {
...
}]);
I understand how it works, but why did the angular guys not decide for a more common approach? For example the requirejs way
someModule.controller('MyController', ['dep1', 'dep2'], function(dep1, dep2) {
...
});
What is bothering me, is that the second argument is a array of dependencies and the callback as the last element at the same time. In fact, the whole module code is written in the last array element.
Wouldn't it be better to have the dependencies in an extra array? This way we could easily pass a array of dependencies dynamically into a definition.
I find this rather awkward but never really thought about the reason behind. Can someone explain this to me?