问题:
如何显示所有单选按钮,但只有一个下拉菜单。这个显示的下拉菜单反映了当前选择的 radiobtn?
html:
<form ng-app="app" ng-controller="Ctrl">
<div class="color-pick" ng-repeat="(key, val) in productData.colors_and_sizes.data">
<input type="radio" name="colors" ng-model="myColor" ng-value="{{key}}" />{{key}}
<div class="size-pick">
<select ng-model="mySize" ng-options="size for size in val.sizes.split(',')"></select>
</div>
</div>
</form>
javascript:
var app = angular.module("app", []);
app.controller('Ctrl', function ($scope, $filter, $http) {
$scope.productData = {
"colors_and_sizes": {
"data": {
"Black": {
"sizes": "X Small, Small, Medium, Large, Xlarge, XX Large"
},
"Blue": {
"sizes": "X Small, Small, Medium, Large, Xlarge, XX Large"
}
}
}
};
});