我是
angularjs和angular-ui的新手,我的模块ui-select有问题.
我需要从列表中选择单个元素,如果没有值,用户可以手动添加,但ui-select的标记系统不能用于单个值,我不知道为什么.
这是ui-select代码:
<ui-select tagging="tagStation" tagging-label="(Add station)" ng-model="new.station">
<ui-select-match placeholder="Choose or Add">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="station.value as station in stationList | filter: { label: $select.label }">
<div ng-bind-html="station.label | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
这是标记属性的功能:
$scope.tagStation = function (newTag) {
var item = {
label: newTag,
value: 0
};
return item;
};
有人能帮我吗?谢谢
最佳答案 查看我正在链接到
here的主题和特定答案.现在有一个解决方法,您可以在其中添加属性tagging-label =“false”.希望能解决您的问题!我正在寻找类似的问题,但不幸的是,对于我来说,这种解决方法似乎并没有解决我的特定问题,因为我无法获得任何自定义值.