我使用以下软件包
$ bower list
bower check-new Checking for new versions of the project dependencies..
(...)
├── angular#1.3.15 (1.3.16-build.113+sha.3881831 available, latest is 1.4.0-rc.2)
├─┬ angular-resource#1.3.15 (1.3.16-build.113+sha.3881831 available, latest is 1.4.0-rc.2)
│ └── angular#1.3.15 (latest is 1.4.0-rc.2)
├─┬ angular-route#1.3.15 (1.3.16-build.113+sha.3881831 available, latest is 1.4.0-rc.2)
│ └── angular#1.3.15
├─┬ angular-sanitize#1.3.15 (1.3.16-build.113+sha.3881831 available, latest is 1.4.0-rc.2)
│ └── angular#1.3.15
├─┬ angular-ui-select#0.11.2
│ └── angular#1.3.15 (1.4.0-rc.2 available)
├─┬ bootstrap#3.3.4
│ └── jquery#2.1.4
├── jquery#2.1.4
├── modernizr#2.8.3
└── normalize.css#3.0.3
我有这个 angular-ui-select 代码
<ui-select
tagging="createTag"
ng-model="needs_ingredient.ingredient"
theme="bootstrap"
ng-disabled="disabled"
title="Zutat auswählen">
<ui-select-match placeholder="Zutat auswählen...">
{{$select.selected.name}}
</ui-select-match>
<ui-select-choices repeat="ingredient in ingredients | filter: {name: $select.search}">
<div ng-if="ingredient.isTag" ng-bind-html="ingredient.name +' <small>(hinzufügen)</small>'| highlight: $select.search"></div>
<div ng-if="!ingredient.isTag" ng-bind-html="ingredient.name + ingredient.isTag | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
其中成分列表的一个元素如下所示
{
"id": 123,
"name": "xyz"
},
这部分 js 代码用于为列表创建新对象
$scope.createTag = function (newTag) {
console.log('createTag');
return {
id: null,
name: newTag
};
};
我希望这是一个列表,我可以在其中选择一个项目或添加一个新项目,但它不起作用。
哪里错了?没有多重选择的标记不起作用吗?
最佳答案
您可以设置:
tagging-label="false"
在 ui-select 标签中。
这对我有用!
关于javascript - Angular 用户界面 - 选择 : tagging without multiple - why isn't this working?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30445532/