如何从角度第一个下拉列表中单击某些选项后启用下拉列表

时间:2016-10-21 16:22:27

标签: angularjs

我的数据库中有educationsschool_courses表。对于上述表格,我有两个单独的下拉列表。在educations中有一个名为has_course的列,它有2个值,1或0,如果值为1,则它有路径,如果没有,则为0。我只想启用school_courses的下拉菜单,如果教育下拉列表中的选定值在has_course列中的值为1。提前谢谢!

1 个答案:

答案 0 :(得分:0)

使用ng-if或ng-show隐藏第二个下拉列表

<select ng-model="education" ng-options="option.name for option in data.educations track by option.id">
</select>

<select ng-if="education === 1" ng-model="course" ng-options="option.name for option in data.courses track by option.id">          
</select>