【问题标题】:Retain selected value from drop down list in html从 html 的下拉列表中保留选定的值
【发布时间】:2017-03-13 04:50:25
【问题描述】:

我的应用程序中有一个下拉列表,我可以从中选择选项。目前所选选项已在 sql 数据库中更新,但是当我重新打开页面时,该值不会显示在 html 页面中。我的 html 代码中还有什么要添加的吗?

这里是sn-p的代码:

<div class="form-group">
    <label class="control-label col-lg-2 pull-left">Quality<span class="Imp">*</span></label>
    <div class="col-lg-8">
        <select id="Quality" name="Quality" class="form-control" style="width:170px" ng-model="vm.Quality" tooltip="Quality is required" tooltip-placement="top" required tooltip-trigger="mouseenter">
            <option value="Satisfactory">Satisfactory</option>
            <option value="Unsatisfactory">Unsatisfactory</option>
        </select>
    </div>
</div>

我更新值

重新打开页面以编辑所选值后不显示

【问题讨论】:

    标签: html css angularjs combobox


    【解决方案1】:

    从数据库中获取保存值后,需要在控制器中初始化下拉值

    $scope.Quality = //something got from databse;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多