gpt4 book ai didi

angularjs - 尝试在标记模式(不是简单标记)中使用angular ui-select2,丢失对象

转载 作者:行者123 更新时间:2023-12-04 13:32:22 25 4
gpt4 key购买 nike

我最近已从angular 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;
},
}

最佳答案

圣牛,Matt/invinity在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

这就彻底解决了。

关于angularjs - 尝试在标记模式(不是简单标记)中使用angular ui-select2,丢失对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21347714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com