AngularJS:如何绑定使用ng-repeat生成的选项值(在select标签中)

时间:2015-01-21 09:59:47

标签: javascript angularjs

我有以下html:

<select id="vehicleMark" name="vehicleMark" ng-disabled="!checked2" ng-model="mark.vehicleMark">
    <option value=""><c:out value=""/></option>
    <c:forEach items="${markeVozila}" var="marka">
        <option value="${marka}"><c:out value="${marka}"/></option>
    </c:forEach>
</select>
<select id="vehicleModel" name="vehicleModel" data-ng-show="mark.vehicleMark != ''" ng-model="vehicleModel">
     <option ng-repeat='model in carModels | filter: mark' value="{{model.modelId}}">
        {{model.vehicleModel}}
     </option>                      
</select>

现在,问题出在第二个选择中,我无法设置选项的值。如何将选项的值设置为模型对象的modelId属性值?

0 个答案:

没有答案