Javascript 选择2下拉菜单选择的值不为';无法使用更新的模型进行更新
我使用最新的select2api(select2-3.4.5),select2的html如下所示Javascript 选择2下拉菜单选择的值不为';无法使用更新的模型进行更新,javascript,angularjs,angular-ui,angularjs-select2,Javascript,Angularjs,Angular Ui,Angularjs Select2,我使用最新的select2api(select2-3.4.5),select2的html如下所示 <select ui-select2 id="select2-test" ng-model="mymodel.myTitle"> <option value="">Title</option> <option ng-repeat="title in nameList" value="{{title.key}}">
<select ui-select2 id="select2-test" ng-model="mymodel.myTitle">
<option value="">Title</option>
<option ng-repeat="title in nameList" value="{{title.key}}">{{title.name}}</option>
</select>
我的所有文本字段都加载了更新的数据,当我打印出{{mymodel}}时,我可以看到更新的模型。
我在$scope.$apply内执行了save和update调用,目的是更新dom元素
当我展开下拉列表(选择2)进行更新后,我可以在选择选项中看到正确更新的值
<option XXXX selected="selected">MYSELECTED</option>
MYSELECTED
但选择2个容器,其中
<span class="select2-chosen">OLD</span> has the old value hence it is shown as the selected value.
OLD具有旧值,因此显示为选定值。
这是select 2的问题还是我遗漏了什么 这可能有助于:
<span class="select2-chosen">OLD</span> has the old value hence it is shown as the selected value.