I am beginner of Angular 1, I understood that $scope is glue between vew and modal.
Could anyone tell me the difference between these three ways of defining a controller.
1)
(function(angular) {
'use strict';
var myApp = angular.module('myApp', []);
myApp.controller('namesCtrl', ['$scope', function($scope) {
$scope.customSpice = 'wasabi';
}]);
})(window.angular);
Is there any use of passing array with values ['$scope',function]. Is function alone is not sufficient?
2)
angular.module('myApp', []).controller('namesCtrl', function($scope) {
});
3)
(function(angular) {
'use strict';
angular.module('invoice1', [])
.controller('namesCtrl', function namesCtrl() {
this.customSpice = 'wasabi';
});
})(window.angular);
How they bond data to $scope in 3rd example I found this example at https://docs.angularjs.org/guide/concepts.