我使用以下软件包
$ 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-code 为列表创建新对象
$scope.createTag = function (newTag) {
console.log('createTag');
return {
id: null,
name: newTag
};
};
我希望这是一个列表,我可以在其中选择一个项目或添加一个新项目,但它不起作用。
错误在哪里?没有多项选择的标记不起作用吗?