【发布时间】:2015-09-03 05:37:46
【问题描述】:
我有许多 select 输入孩子,其数据会根据父母的选择而变化。
请参阅此Codepen,了解将形成我的父子关系的数据类型。
我的起始代码在这里:
控制器
$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>
只有在选择了相应的父级时,子级才可见。
【问题讨论】:
-
那么你的问题是什么?
标签: javascript angularjs ionic-framework ng-options