我一直在看这个问题太久了,无法弄清楚为什么这些选项没有显示出来。使用1.2.26
{{students}}
<select name="student" ng-options="i.id as i.first_name for i in students"></select>
因此,这会输出一个选择但没有选项。学生已填充并显示为
[{"first_name":"Student","last_name":"Seven","email":"","order":"0","id":11,"rLevel":2},{"first_name":"Student","last_name":"Eight","email":"","order":"6","id":12,"rLevel":2},{"first_name":"Student","last_name":"Six","email":"","order":"2","id":10,"rLevel":2},{"first_name":"Studen","last_name":"Four","email":"","order":"1","id":8,"rLevel":2}]
我知道角度已初始化,学生是一组对象。这个循环恰好在选择输出和功能之下。
<li ng-repeat="student in students">
<a href="#" ng-click="addStudent(student.id)">{{student.first_name}} {{student.last_name}}</a> <span ng-show="student.id == class.current_student.id"></span>
</li>
答案 0 :(得分:1)
您的选择中没有ng-model
属性。 ng-options
仅适用于ng-model
,否则无法绑定。
另外,我刚刚注意到select指令源的line 388。这取决于ngModelController
render
功能,以实际填充DOM中的选项。