My application gives users the option to choose from several dropdown menus and the third menu should be dynamic depending on the selection from the previous two menus.
I am using ng-repeat and ng-if to set the condition like this
// First dropdown menu
<select ng-model="letter" class = "form-control">
<option ng-repeat= "letter in letters" value = "letter">{{letter}}</option>
</select>
<br>
// second dropdown menu
<select ng-model="number" class = "form-control">
<option ng-repeat = "number in numbers" value = "number">{{number}}</option>
</select>
<br>
// third dropdown menu
<select ng-model="color" class="form-control">
<option ng-repeat="A1_color in A1_colors" ng-if= "letter = A & number = 1" value="{{A1_color}}">{{A1_color}}</option>
</select>
...
<select ng-model="color" class="form-control">
<option ng-repeat="B2_color in B2_colors" ng-if= "letter = B & number = 2" value="{{B2_color}}">{{B2_color}}</option>
</select>
In my controller, I have the lists like this
$scope.letters = {'A', 'B'};
$scope.numbers = {'1', '2'};
$scope.A1_colors = {'red', 'pink'};
$scope.A2_colors = {'blue', 'black'};
$scope.B1_colors = {'yellow', 'orange'};
$scope.B2_colors = {'white', 'black'};
So if the user selects 'A' from the first menu and '2' from the second menu, he should see the options for 'A2_colors' in the third menu. What is the right way to do this?