angularjs $timeout without delay parameters reason

前端 未结 1 609
忘掉有多难
忘掉有多难 2020-12-14 15:09

In a few script I can find for instance

$timeout(function () {
    $scope.my = 1;            
});

instead of simply

$scope.         


        
相关标签:
1条回答
  • 2020-12-14 15:57

    This is a hack. :) But usually the intention is to wait until the end of the $digest cycle and then set $scope.my to 1. Timeouts are called after all watches are done.

    0 讨论(0)
提交回复
热议问题