Saturday, 15 June 2013

How does AngularJS $watch these cases in an ng-repeat? -


I think AngularJS sets some watches on ng-repeat. What type of clock is set at this point?

In addition to this, can anyone tell what happens in each of these scenarios? I want to know in this incident that I have many things, so the user is not being thrown out of the clocks which could have ended, I wrote it in another way.

one

    

two

  & lt; Div ng-repeat = "item in item" & gt; & Lt; Div & gt; {{Item.property | MyFormatter}} & lt; / Div & gt; & Lt; / Div & gt;   

three

  & lt; Div ng-repeat = "item in item" & gt; & Lt; Div & gt; {{Format (item.property)}} & lt; / Div & gt; & Lt; / Div & gt;   

Four

  & lt; Div ng-repeat = "item in item" & gt; & Lt; Div & gt; {{Item.something ()}} & lt; / Div & gt; & Lt; / Div & gt;  

every ng-repeat will set a $ watch < At Code> Items (if you look at it, most of this is the $ 100 Execution Function for the Watch Method). Each time an angular conducts, items will be checked by this clock function in items . (Note that in the Digest cycle, this clock function can be called more than once).

Each {{}} sets a $ watch if something like {code> item.property is inside of {{}} s, then it In the digestive cycle, dirty check is done at least once.

If a function is {{}} inside, then that function is said at least once in the Digest cycle.

I'm not sure about the x I filter , but it seems that the filter is called at least once in each digest cycle, even if x does not change.

No comments:

Post a Comment