今天突然就想写写$digest和$apply,这些都是脏值检查的主体内容. 先以普通js来做一个简单的监控例子吧: var div = ducoment.getElementById("myDiv"); div.addEventListener("click",function(e){ console.log(e); }) 在这里,我们给一个div绑定了个点击事件,并且给这个绑定事件一个回调函数.这里我们就是给了这个div一个监听,当监听到有点击事件发生在此div上…
Dirty Checking (脏值检查) Digest cycle and $scope Digest cycle and $scope First and foremost, AngularJS defines a concept of a so-called digest cycle. This cycle can be considered as a loop, during which AngularJS checks if there are any changes to all t…
Dirty Checking (脏值检查) Digest cycle and $scope Digest cycle and $scope First and foremost, AngularJS defines a concept of a so-called digest cycle. This cycle can be considered as a loop, during which AngularJS checks if there are any changes to all t…
今天突然就想写写$digest和$apply,这些都是脏值检查的主体内容. 先以普通js来做一个简单的监控例子吧: var div = ducoment.getElementById("myDiv"); div.addEventListener("click",function(e){ console.log(e); }) 在这里,我们给一个div绑定了个点击事件,并且给这个绑定事件一个回调函数.这里我们就是给了这个div一个监听,当监听到有点击事件发生在此div上…
w3shools angularjs教程 wiki <AngularJS权威教程> Introduction AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag. AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions.…