Check out this Angular code snippet from the following page: http://docs.angularjs.org/guide/controller
1 var myApp = angular.module('myApp',[]);
2
3 myApp.controller('GreetingCtrl', ['$scope', function($scope) {
4 $scope.greeting = 'Hola!';
5 }]);
In line #3 above, what is the purpose of the string '$scope'
?
Is it possible to achieve the same result with this approach?
myApp.controller('GreetingCtrl', function($scope) { ... })
What advantages does using an array and mentioning the argument name provide?