Open hjzheng opened 8 years ago
$document 等于 angular.element(window.document) 实际上它是 jqLite 对 window.document的包装 $window.document 等于 window.document 它们都是 DOM element document.
$window.document === $document[0] //true
$window 其实是 AngularJS 将全局 window 对象包装成的服务
Angular's wrapper for window.setTimeout. The fn function is wrapped into a try/catch block and delegates any exceptions to $exceptionHandler service.
$timeout([fn], [delay], [invokeApply], [Pass]);
注意 $timeout 第三个参数,是否调用 apply 方法, 这是 AngularJS 性能的一个优化点。
区别同上, 可以参考官方API https://docs.angularjs.org/api/ng/service/$interval
真及时!
区别
$document 等于 angular.element(window.document) 实际上它是 jqLite 对 window.document的包装 $window.document 等于 window.document 它们都是 DOM element document.
联想
window 和 $window 的区别?
$window 其实是 AngularJS 将全局 window 对象包装成的服务
settimeout 和 $timeout 的区别?
$timeout([fn], [delay], [invokeApply], [Pass]);
注意 $timeout 第三个参数,是否调用 apply 方法, 这是 AngularJS 性能的一个优化点。
setInterval 和 $setInterval 的区别?
区别同上, 可以参考官方API https://docs.angularjs.org/api/ng/service/$interval