I see in most examples that controllers are written this way, with an array as the second argument. And I guess the array has the dependencies listed out, then the anonymous function with the dependencies as arguments...
myApp.controller('DoubleCtrl', ['$scope', function($scope) {
$scope.double = function(value) { return value * 2; };
}]);
and then I see sometimes they are written this way, without the array & independently listed dependencies, just the anonymous function with them as arguments.
myApp.controller('DoubleCtrl', function($scope) {
$scope.double = function(value) { return value * 2; };
});
What's the difference? Which is better, preferred, ...?