angularjs $超时没有延迟参数原因 [英] angularjs $timeout without delay parameters reason
本文介绍了angularjs $超时没有延迟参数原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一些脚本中,我可以找到例如
In a few script I can find for instance
$timeout(function () {
$scope.my = 1;
});
而不是简单地
$scope.my = 1;
立即调用$ timeout的目的是什么?
What's the purpose to call $timeout without delay?
推荐答案
这是黑客. :)但通常的目的是要等到$digest
循环结束,然后将$scope.my
设置为1
.完成所有监视后,将调用超时.
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.
这篇关于angularjs $超时没有延迟参数原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文