Mic*_*kin 6 angularjs angular-ui ui-select2 angularjs-select2
我最近从1.1.4升级到1.2.9,并抓住了最新的ui-select2指令和最新的select2组件.标签模式下的select2s已停止工作.选项列表和预先输入工作,但当我从中选择任何内容时,新标记显示为没有任何值的空白内容,并对其进行调试,我看到它正在从{text:"foo",id:10}切片低至10 - 对象正在被id替换.我真的很感激有关为什么会发生这种情况的任何见解.
演示:http://plnkr.co/edit/RepMSFQsIPDuPTNFWKUN?p = preview
这是我的select2选项:
.controller('AppController', function($scope) {
availableTags = [
{text: 'Apple', id: 1},
{text: 'Apricot', id: 2},
{text: 'Avocado', id: 3},
];
$scope.select2Options = {
tags: availableTags,
multiple: true,
minimumInputLength: 1,
formatResult: function (item) {
return item.text;
},
formatSelection: function (item) {
return item.text;
},
}
Run Code Online (Sandbox Code Playgroud)
Mic*_*kin 13
神圣的牛,马特/无限回答了我关于github问题的问题:
https://github.com/angular-ui/ui-select2/issues/144#issuecomment-33287882
I had this same behavior and was able to correct it by changing the input type to
"hidden". See if that works for you.
-matt
Run Code Online (Sandbox Code Playgroud)
这完全解决了它.
这显然是版本问题。我认为 Select2 不支持 Angular 1.2.5。并且可能只支持<1.2 版本。
你的 plunker 的这个分支正在工作(Angular 版本 1.1.5)。
我什么也没做,只是更改了版本号。
在 GitHub 上将此作为错误提出是正确的做法。:)
| 归档时间: |
|
| 查看次数: |
6336 次 |
| 最近记录: |