Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 选择2下拉菜单选择的值不为';无法使用更新的模型进行更新_Javascript_Angularjs_Angular Ui_Angularjs Select2 - Fatal编程技术网

Javascript 选择2下拉菜单选择的值不为';无法使用更新的模型进行更新

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}}">

我使用最新的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}}">{{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.