I am new to Angular JS.I am trying to gain some in depth knowledge in it by understanding the controller functionality.
I came across the following code snippets.
var App = angular.module('clientApp', ['ngResource', 'App.filters']);
App.controller('ClientCtrl', ['$scope',function ($scope) {
}]);
What significant difference does it make if i write :
var App = angular.module('clientApp', ['ngResource', 'App.filters']);
App.controller('ClientCtrl', function ($scope) {
});
My Understanding: I do understand that something written in the square brackets is dependency for that particular module or controller.However,I couldnot understand the reason for writing
"['$scope',function($scope)"
instead of
App.controller(controllername,function($scope){
});
Any help wouls be highly appreciated!