How to show tags using select2 in select tag using angularjs
I want to set tags in a select2 dropdown. For example, I want to put a custom email or whatever, then it should be displayed as a tag. I am sharing a 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
};
+3
source to share