Apologies if this question sounds too obvious.
I've recently starting exploring and learning AngularJS. I've gone through some good tutorials -
.. and there are a few other that I've seen.
I'm not saying that I've read/studied all the documents.
Question starts here -
Now, coming to the question, I see that the definition of a Controller is different in one place and it's different in some other -
One definition uses a sort of array notation (not sure of the official term) for injection:
app.controller("MyCtrl", ['$scope', function($scope){
$scope.someData = "Array notation";
}]);
And there's this, with no array:
app.controller("MyCtrl", function($scope){
$scope.someData = "non-array notation";
});
Not saying this is the only thing that I'm trying to understand but yes, I'd definitely love to understand the difference.
Is there a major difference between the two?
Thanks a lot.
Note: I did search for similar questions in SO but couldn't find what I was looking for. Sorry.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…