答案 0 :(得分:1)
为什么不ng-options
?
<select size="6" name="ngvalueselect" ng-model="data.model" ng-options="item.value as item.name for item in data.availableOptions" multiple></select>
答案 1 :(得分:0)
我相信你的选择应该是这样的:
<select size="6" name="ngvalueselect" ng-model="data.model" ng-options="option.value as option.name for option in data.availableOptions" multiple>
所以不应该有任何单独的选项
答案 2 :(得分:-4)
$(本).find(&#34;:选择&#34)。数据(&#34;值&#34)
<form name="myForm">
<label for="ngvalueselect"> ngvalue select: </label>
<select size="6" name="ngvalueselect" ng-model="data.model" multiple>
<option ng-repeat="option in data.availableOptions" data-option="{{option.value}}">{{option.name}}</option>
</select>
</form>
<hr>
<pre>model = {{data.model | json}}</pre><br/>
</div>
</body>
</html>
如果jquery使用:
$(document).on("change","select",function(){
var objectOrStringReturend = $(this).find(":selected").data("value");
});