<div ng-app="myApp" ng-controller="DoubleController" ng-init="content=50">
<h1>{{double(50)}}</h1>
</div>
In the script part there are two styles.
myApp.controller('DoubleController', function ($scope) {
$scope.double = function (value) {
return value * 2;
};
});
and
myApp.controller('DoubleController', ['$scope', function($scope) {
$scope.double = function(value) { return value * 2; };
What is the difference between these two styles and what does $scope
mean in ['$scope', function($scope){} ]
.
Thanks.