I have a number of select
input children thats data changes depending on the parents selection.
Please see this Codepen for the type of data that will form my parent child relationship.
My starting piece of code is here:
Controller
$scope.params = ['Sets', 'Reps', 'Colour', 'Time', 'Weight'];
$scope.children = [{
'Sets': ['1', '2', '3', '4', '5']
}, {
'Reps': ['1', '2', '3', '4', '5']
}, {
'Colour': ['Red', 'Green', 'Blue', 'Yellow', 'Pink']
},
];
HTML
<label class="item item-input item-select">
<div class="input-label positive">
Param
</div>
<select ng-model="param">
<option ng-repeat="param in params" value="{{param}}">{{param}}</option>
</select>
</label>
<label ng-show="param" class="item item-input item-select">
<div class="input-label positive">
Sets
</div>
<select ng-model="param">
<option ng-repeat="param in params" value="{{param}}">{{param}}</option>
</select>
</label>
The children will only be visible if the corresponding parent is selected.
I would change the model like this:
And then do something like this:
http://codepen.io/anon/pen/RPZzdM