I was reading Mastering Web Application Development with AngularJS book, and in the chapter 3 when the autors took about $q and promises they write and example of a single $timeout.
index.html
<h1>Hello, {{name}}!</h1>
controller.js
$scope.name = $timeout(function () {
return "World";
}, 2000);
The thing is that i test the code and this don't work for me, i don't if i write some wrong, i write it and look it several time but i don't know where is the error.
I change the code in the controller for:
$timeout(function () {
$scope.name = "World";
}, 2000);
and work perfectly.
Anyone know why this happened?, I include a plunk of the example here