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
Post a Comment