I have a controller without $scope
angular.module('todoApp', [])
.controller('TodoListController', function() {
var todoList = this;
todoList.title = "Default title";
setTimeout(function() {
todoList.title = "Another title will appear after 5 seconds";
}, 5000);
// ...some magic here
});
And view:
<h1>Current title: {{TodoListController.title}}</h1>
This code won't works correctly, becaufe function in setTimeout
won't run $digest()
which can update my TodoListController.title
.
I know I can use $scope
and use $scope.$digest()
. But - is it possible to run $digest()
without it? I have always access to object angular
. Maybe through this object?