角度组逗号分隔选择选项中的值

时间:2017-09-12 10:57:23

标签: javascript angularjs

我遇到这个问题我无法在选择下拉选项中对这个逗号分隔值进行分组,这是我的代码:

这是模型:

enter image description here

角色代码:

<select ng-model="attrModel" ng-options="option.Value group by option.Key.Name for option in attrModel track by option.Value"></select>

结果:

enter image description here

结果:

enter image description here

1 个答案:

答案 0 :(得分:0)

问题是您将整个 <?php include "config.php"; if(isset($_POST['submit'])) { $target = "images/".basename($_FILES['image']['name']); $v_type = $_POST["v_type"]; $v_name = $_POST["v_name"]; $v_man = $_POST["v_man"]; $v_model = $_POST["v_model"]; $v_color = $_POST["v_color"]; $v_trans = $_POST["v_trans"]; $v_1_15_rent = $_POST["v_1_15_rent"]; $v_16_25_rent = $_POST["v_16_25_rent"]; $v_25_plus_rent = $_POST["v_25_plus_rent"]; $v_reg = $_POST["v_reg"]; $vendor_name = $_POST["vendor_name"]; $vendor_mobile = $_POST["vendor_mobile"]; $vendor_price = $_POST["vendor_price"]; $image = $_FILES["image"]["name"]; $v_id=$_GET["v_id"]; $sql = " UPDATE my_veh_ven SET v_type='$v_type', v_name='$v_name' ,v_man='$v_man' ,v_color='$v_color', v_trans='$v_trans', v_1_15_rent='$v_1_15_rent' , v_16_25_rent='$v_16_25_rent' ,v_25_plus_rent='$v_25_plus_rent' , image='$image' , v_reg='$v_reg' ,vendor_name='$vendor_name', vendor_mobile='$vendor_mobile' ,vendor_price='$vendor_price' WHERE v_id='$v_id' "; if (mysqli_query($conn, $sql)) { if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $success = "✓ Successfully Updated"; } } else { $fail = "X Not Updated"; } } mysqli_close($conn); ?> 数组作为值传递给Value标记。

我不是100%确定如何正确处理选择中的嵌套数组,但您可以使用<optgroup>

<option>

查看工作plnkr