javascript - AngularJS - Purpose of Writing $scope Before function($scope) -


I started learning AngularJS by looking at some examples in Google, but it was not explained. So far, I went through some examples where they

  myApp.controller ('MainCtrl', function ($ scope) {$ scope.text = 'hello, corner radical;;}) ;  

But some other blogs include '$ scope' before those tasks ($ scope)

  myApp.controller ('MainCtrl' , ['$ Scope', function ($ scope) {$ scope.text = 'hello, cornal radical.';}]);  

Is there any difference? Not just the scope of the dollar, similarly to other dependencies.

In short, the two methods of declaring dependencies are the same. Array notation is used so that minimizer does not minimize dependency and the angle will know what to get.

If you do not shorten your code, you can use any type of dependency injection.