I am learning AngularJS, and am currently trying master Dependency Injection.
When I define a controller, the documentation tells me that specifying dependencies through annotations, and just listing them in the parameter list for the constructor are equivalent. Hence, I should get the same outcome if I write either:
angular
.module('myapp.controllers', [])
.controller('MainNavigationController', ['$scope', '$location', function ($scope, $location) {
// ... some code
}]);
or:
angular
.module('myapp.controllers', [])
.controller('MainNavigationController', function ($scope, $location) {
// ... some code
});
Is there any practical reasons I should prefer the former, since it seems to be needlessly verbose?