-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Expand file tree
/
Copy pathautocomplete-auto-select-example.html
More file actions
44 lines (41 loc) · 1.66 KB
/
autocomplete-auto-select-example.html
File metadata and controls
44 lines (41 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<div class="example-combobox-container">
<div #origin class="example-autocomplete">
<span class="example-search-icon material-symbols-outlined" translate="no">search</span>
<input
ngCombobox
#combobox="ngCombobox"
aria-label="Label dropdown"
placeholder="Select a country"
[(value)]="searchString"
[(expanded)]="popupExpanded"
/>
<button
class="example-clear-button"
aria-label="Clear"
(keydown)="onKeydown($event)"
(click)="clear()"
>
<span aria-hidden="true" class="example-clear-icon material-symbols-outlined">close</span>
</button>
</div>
<div aria-live="polite" class="cdk-visually-hidden">
{{countries().length === 0 ? 'No results found for ' + query() : ''}}
</div>
<ng-template [cdkConnectedOverlay]="{origin, usePopover: 'inline', matchWidth: true}" [cdkConnectedOverlayOpen]="true">
<ng-template ngComboboxPopup [combobox]="combobox">
<div class="example-popup">
@if (countries().length === 0) {
<div class="example-no-results">No results found</div>
}
<div ngListbox ngComboboxWidget focusMode="activedescendant" [tabIndex]="-1" [(value)]="selectedOption" (click)="onCommit()" (keydown.enter)="onCommit()">
@for (country of countries(); track country) {
<div ngOption [value]="country" [label]="country" [disabled]="country === 'Brazil'">
<span class="example-option-label">{{country}}</span>
<span class="example-check-icon material-symbols-outlined" translate="no">check</span>
</div>
}
</div>
</div>
</ng-template>
</ng-template>
</div>