<select class="form-control" ng-model="filterFormInputs.apps"
ng-options="app.Application for app in d">
<option value="" disabled selected>Select an Application</option
</select>
我的index.html中有上面的代码片段。和
在我相应的控制器中我有
$scope.d = [{"Application": "app1", "details":[{"name":"name1"},{"name":"name2"},{"name":"name3"}]}, {"Application":"app2", "details":[{"name":"name4"},{"name":"name5"},{"name":"name6"}]}]
如何制作,当我从选择表单中选择“app1”时,我可以使用相应的“名称”字段填充复选框列表“?例如,如果我选择app1,我想要三个复选框要显示的是name1,name2和name3。如果我从选择表单中选择app2,我想要三个带有app4,app5和app6的复选框出现?使用ng-repeat / ng-model
答案 0 :(得分:3)
您还需要一个ngRepeat。例如:
<select class="form-control" ng-model="filterFormInputs.apps" ng-options="app.Application for app in d">
<option value="" disabled selected>Select an Application</option>
</select>
<label ng-repeat="checkbox in filterFormInputs.apps.details">
<input type="checkbox" ng-model="checkbox.checked"> {{checkbox.name}}
</label>
您只需要决定哪些模型绑定这些复选框。