angualrjs中$timeout和$interval什么区别?
$timeout(function(){ $scope.name = '123'; },1100);
$interval(function(){ $scope.name = '123'; },1100);
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
在angularjs中,$timeout和$interval分别是window.setInterval 和 window.setTimeout的封装。
更具体的区别推荐看一下这篇文章:
http://www.yeeyan.org/articles/view/luosheng/24380
原文是jquery作者写的:
http://ejohn.org/blog/how-javascript-timers-work/
$timeout
$interval
这样的问题多看官方文档,对你帮助更大