Angular JS executing function $timer within $scope receives TypeError
问题 Why is that when using $timeout in Angular JS that is inside function like the following, works fine. var mytimeout = $timeout(function(){ console.log("MyTimeout Executed"); },2000); mytimeout.then( function() { console.log( "mytimeout resolved!", Date.now() ); }, function() { console.log( "mytimeout rejected!", Date.now() ); } ); but when I use $timer with a function inside $scope it does not work, like this: $scope.myFunction = function(){ console.log("MyTimeout Executed"); }; var mytimeout