1

What is the difference between the two implementations of an angularjs controller ?

<script>
angular.module('myApp',[]).controller('myCtrl', ['$scope', function($scope) {
    $scope.firstName = "John";
    $scope.lastName = "Doe";
}]);
</script>

and

<script>
angular.module('myApp',[]).controller('myCtrl', function($scope) {
    $scope.firstName = "John";
    $scope.lastName = "Doe";
});
</script>

I figured that both do the same thing but do they work the same? I'm just getting started with angularJS and I am just beginning to understand controllers.

0 Answers0