If you use bootstrap from a design point of view, you can also use the fa-remove icon.
In addition, in terms of usability, you might want to align the delete icon on the left.
JS:
<ui-select-match placeholder="Select or find..."> <button class="clear-btn" ng-click="clear($event)"> <span class="fa fa-remove"></span> </button> <span class="clear-btn-offset">{{$select.selected}}</span> </ui-select-match>
CSS:
.select2 .clear-btn { background: none; border: none; cursor: pointer; padding: 5px 10px; position: absolute; left: -2px; top: 1px; } .clear-btn-offset { position: absolute; left: 25px; }
In the directive code:
$scope.clear = function($event) { $event.stopPropagation();
Igor Lino Feb 25 '15 at 9:15 2015-02-25 09:15
source share