Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit e4e5048

Browse files
committed
fix(bootstrap): allow-clear style
1 parent 73e30ec commit e4e5048

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/bootstrap/match.tpl.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<div class="ui-select-match" ng-hide="$select.open" ng-disabled="$select.disabled" ng-class="{'btn-default-focus':$select.focus}">
2-
<button aria-label="{{ $select.baseTitle }} activate" type="button" class="btn btn-default form-control ui-select-toggle" tabindex="-1" ;="" ng-disabled="$select.disabled" ng-click="$select.activate()">
2+
<button type="button" tabindex="-1"
3+
class="btn btn-default form-control ui-select-toggle"
4+
aria-label="{{ $select.baseTitle }} activate"
5+
ng-disabled="$select.disabled"
6+
ng-click="$select.activate()">
37
<span ng-show="$select.isEmpty()" class="ui-select-placeholder text-muted">{{$select.placeholder}}</span>
48
<span ng-hide="$select.isEmpty()" class="ui-select-match-text" ng-class="{'ui-select-allow-clear': $select.allowClear && !$select.isEmpty()}" ng-transclude=""></span>
59
<i class="caret pull-right" ng-click="$select.toggle($event)"></i>
6-
<button aria-label="{{ $select.baseTitle }} clear" type="button" class="ui-select-clear" ng-if="$select.allowClear && !$select.isEmpty()" ng-click="$select.select(undefined)">
7-
<i class="glyphicon glyphicon-remove"></i>
10+
<a ng-show="$select.allowClear && !$select.isEmpty()" aria-label="{{ $select.baseTitle }} clear" style="margin-right: 10px"
11+
ng-click="$select.clear($event)" class="btn btn-xs pull-right">
12+
<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
13+
</a>
814
</button>
915
</div>

src/select.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@
466466
}
467467
};
468468

469+
ctrl.clear = function($event) {
470+
ctrl.select(undefined);
471+
$event.stopPropagation();
472+
ctrl.focusser[0].focus();
473+
};
474+
469475
// Toggle dropdown
470476
ctrl.toggle = function(e) {
471477
if (ctrl.open) {

src/select2/match.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
ng-click="$select.activate()" aria-label="{{ $select.baseTitle }} select">
99
<span ng-show="$select.isEmpty()" class="select2-chosen">{{$select.placeholder}}</span>
1010
<span ng-hide="$select.isEmpty()" class="select2-chosen" ng-transclude></span>
11-
<abbr ng-if="$select.allowClear && !$select.isEmpty()" class="select2-search-choice-close" ng-click="$select.select(undefined)"></abbr>
11+
<abbr ng-if="$select.allowClear && !$select.isEmpty()" class="select2-search-choice-close" ng-click="$select.clear($event)"></abbr>
1212
<span class="select2-arrow ui-select-toggle" ng-click="$select.toggle($event)"><b></b></span>
1313
</a>

0 commit comments

Comments
 (0)