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

标签 html css angularjs combobox

我的应用程序中有一个下拉列表,我可以从中选择选项。目前所选选项已在 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>

我更新值

enter image description here

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

enter image description here

最佳答案

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

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

关于html - 从html中的下拉列表中保留选定的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42756838/

相关文章:

html - 在移动设备上触摸屏幕时标记所有网页

javascript - 当复选框值更改时,$watch 不会在 Angular 指令中被命中

javascript - Angular 自定义过滤器不更新 ng-repeat

jquery - 添加 "wrapper"div标签来包裹其他html div标签?

javascript - ASP.NET Resource resx String 工具提示显示帮助

javascript - 为什么我的两个 div 总是紧挨着?

javascript - 如何创建带有标题而不是箭头的 slider

javascript - AngularJS 中的 Phonegap ondeviceready 事件

html - 使 div 宽度适合 float 内容

javascript - 仅在页面刷新后加载 Jquery 脚本