What are the differences between ng-repeat and ng-options and why do they not behave the same way?

后端 未结 5 987
盖世英雄少女心
盖世英雄少女心 2020-11-27 20:31

How do ng-options and ng-repeat differ?

In the following code, I have an ng-repeat that iterates through a list of people:

5条回答
  •  眼角桃花
    2020-11-27 20:54

    In many cases, ngRepeat can be used on elements instead of ngOptions to achieve a similar result. However, ngOptions provides some benefits, such as more flexibility in how the 's model is assigned via the select as part of the comprehension expression, and additionally in reducing memory and increasing speed by not creating a new scope for each repeated instance.

提交回复
热议问题