I'm trying to remove options from drop downs based on the selections made in other drop downs.
For instance, on page load, I have one drop down, and a button which allows the creation of another drop down.
code for my operation:
<div class="form-inline" ng-repeat="setting in sensor.settings">
<select class="form-control" ng-model="setting.port" ng-options="item.name group by item.type for item in ports track by item.name">
<option value="">-- Module Port --</option>
</select>
</div>
<a href ng-click="newItem($event, sensor.settings)">New Port</a>
Expected Result:
If only one drop down exists, a user can select any option in it and no additional logic needs to be executed.
However, if the "new port" button is clicked, it'll create additional drop downs with the same options as the first, second, etc... What I'm looking to do is remove the options which are selected in any of the drop downs from those which the option wasn't selected from to prevent duplicate selections.
So for instance, if I have 3 drop downs, and the available selections to all drop downs are D1, D2, and D3; the user selects D1 for the first, which removes option D1 from drop downs 2 & 3. D2 is selected in the second, which removes D2 from drop down 1 & 3, leaving drop down 3 with a single selection of D3.
Here's a link to my code: