我的应用程序中有一个下拉列表,我可以从中选择选项。目前所选选项已在 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>
我更新值
重新打开页面进行编辑后,所选值未显示
最佳答案
从数据库中获取保存值后,需要在 Controller 中初始化下拉值
$scope.Quality = //something got from databse;
关于html - 从html中的下拉列表中保留选定的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42756838/