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

这是代码片段:

<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 - 保留html下拉列表中的选定值-LMLPHP

重新打开页面进行编辑后,所选值未显示

html - 保留html下拉列表中的选定值-LMLPHP

最佳答案

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

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

10-06 14:02
查看更多