angularjs - Angular js Injection Clarification -


i m new angular js , going through few angular js tutorials. below 1 one of controller method. in first case, $scope included part of array string in second case $scope injected in function alone both works fine. difference , approach has used?

 app.controller('mycontroller', ['$scope', function ($scope) {             $scope.message = "test success";         }]);          app.controller('mycontroller', function ($scope) {             $scope.message = "test success";         }); 

both notations equal in eyes of angular. prefer , recommend first 1 even.

even though above comments correct, minification break this, there still ngannotate built this: using second notation converts array notation when minifying


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -