我有3个选择下拉列表,我想要下面的场景:
dropdown1:1
dropdown2:2
dropdown3:3
dropdown1:3
dropdown2:1
dropdown3:2
dropdown1:2
dropdown2:3
dropdown3:1
<body ng-app="my-app" ng-controller="my-controller">
<select class="form-control" ng-options="obj as obj.title for obj in sequence" ng-model="selectedView1"></select>
<select class="form-control" ng-options=" obj.title for obj in sequence" ng-model="selectedView2"></select>
<select class="form-control" ng-options=" obj.title for obj in sequence" ng-model="selectedView3"></select>
</body>
请参阅codepen链接。
答案 0 :(得分:0)
我添加了在第一个框中选择1时更改其他选择框的逻辑。
请查看here。
使用watch
功能,您可以在更改选择时更新其他框。
$scope.$watch('selectedView1', function(newValue) {
if (newValue && newValue.title === 1) {
$scope.selectedView2 = $scope.sequence[1];
$scope.selectedView3 = $scope.sequence[2];
}
});