我想使用 select2 在下拉列表中设置标签。就像我想放置自定义电子邮件或其他任何内容一样,它应该显示为标签。 我正在分享 jsfiddle。
<div ng-controller="MyCtrl">
<label>Please select items:</label>
<select ui-select2 multiple ng-model='selectedDaltons'>
<option ng-repeat="d in daltons" ng-bind="d" value="{{ d }}"></option>
</select>
</div>
var myApp = angular.module('myApp', ['ui.select2']);
function MyCtrl($scope) {
$scope.daltons = [
'Joe',
'William' ,
'Jack' ,
'Averell' ,
'Ma'
];
$scope.selectedDaltons = 'joe'; // Averell is preselected
};
最佳答案
在ui-select中,你可以使用'tagging'功能,你甚至可以设置tagging-label。 查看此链接
https://github.com/angular-ui/ui-select/wiki/ui-select
还有这个笨蛋:
http://plnkr.co/edit/m1SQXUxftBLQtitng1f0
关于javascript - 如何使用angularjs在选择标签中使用select2显示标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30998727/