In a few script I can find for instance
例如,在一些脚本中我可以找到
$timeout(function () {
$scope.my = 1;
});
instead of simply
而不是简单地
$scope.my = 1;
What's the purpose to call $timeout without delay?
不延迟调用$timeout的目的是什么?
1 个解决方案
#1
49
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.
这是一个黑客。:)但通常目的是等到$摘要周期结束后再设置$scope。我1。所有手表都完成后,就会调用超时。
#1
49
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.
这是一个黑客。:)但通常目的是等到$摘要周期结束后再设置$scope。我1。所有手表都完成后,就会调用超时。