lundi 26 janvier 2015

Difference of function($scope) and ['$scope', function($scope)] in AngularJS

I am new to AngularJS. I try to find out whats the difference between these two controller definitions:



app.controller('simpleController', ['$scope', function($scope) {
}]);

app.controller('simpleController', function($scope) {
});


I always use the second example, but sometimes I see people using the first example. Why should I do that? Is the controller in the first example inheriting another $scope variable?


Aucun commentaire:

Enregistrer un commentaire