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