我是 angularjs 和 angular-ui 的新手,我对模块 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;
};
有人能帮我吗?谢谢