我最近从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)