Why is a function in ng-repeat called several times?

后端 未结 2 1711
梦谈多话
梦谈多话 2021-01-21 06:47

I want to supply a ng-repeat element by a controller function as follows:

2条回答
  •  春和景丽
    2021-01-21 07:25

    a little bit about the digest cycle:

    we need to check every time something in the application changes - what was effected by that change, and re-evaluate all the places that might depend on that change,

    so that is why the function in the ng-repeat was called multiple times - it had to check wheter the repeated list is the same after some changes happend in the application

    read more about the digest cycle and two-way data binding:

    http://blog.bguiz.com/post/60397801810/digest-cycles-in-single-page-apps/

提交回复
热议问题