我能用ng-model读取多选中存在的所有值或选项吗?

时间:2017-09-01 04:33:36

标签: javascript html css multi-select angular-ngmodel

如何选择多选的所有值并将它们传递给ng-model?



<div class="row">
  <div class="col-md-5">
    <div class="form-group">
      <label for="availablevalues">Select Values</label>
      <select multiple class="form-control" size="10" id="availablevalues">
        <option>A</option>
      </select>
    </div>
  </div>
  <div class="col-md-2">
    <hr>
    <div class="form-group">
      <button class="form-control btn-primary" type="button" onclick=""><span class="glyphicon glyphicon-chevron-right"></span></button>
    </div>
    <div class="form-group">
      <button class="form-control btn-primary" type="button" onclick=""><span class="glyphicon glyphicon-chevron-left"></span></button>
    </div>
  </div>
  <div class="col-md-5">
    <div class="form-group">
      <label for="selectedvalues">Selected values</label>
      <select multiple class="form-control" size="10" id="selectedvalues" name="selectedvalues" required ng-model="selectedValueInCtrl">
        <option>B</option>
        <option>C</option>
        <option>D</option>
      </select>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

如何选择多选的所有值并将它们传递给ng-model?

0 个答案:

没有答案