Two code samples:
First:
var app = angular.module('MyApp', []);
app.controller('MyCtrl', function($scope){
$scope.equation = {};
$scope.change = function() {
$scope.equation.output = Number($scope.equation.x) + 2;
}
});
Second:
var app = angular.module('MyApp', []);
app.controller('MyCtrl', ['$scope', function($scope){
$scope.equation = {};
$scope.change = function() {
$scope.equation.output = Number($scope.equation.x) + 2;
}
}]);
I currently have both of them working.
What's with the []
enclosing the callback in the second sample? And what is different between these implementations?