I'm doing an online course on AngularJS and they suggest to write controllers like this:
Controller:
app.controller("TestController", function() {
this.printable = "Hello, World";
});
View:
<div ng-controller="TestController as test">
<h1>{{ test.printable }}</h1>
</div>
Which is odd, as every other tutorial I've read suggests to write the controller as:
app.controller("TestController", ["$scope", function($scope) {
$scope.printable = "Hello, World";
});
What's the difference between the two approaches?