-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Expand file tree
/
Copy pathautocomplete-selected-trigger.ts
More file actions
39 lines (36 loc) · 1.19 KB
/
autocomplete-selected-trigger.ts
File metadata and controls
39 lines (36 loc) · 1.19 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
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Directive, InjectionToken, TemplateRef, inject} from '@angular/core';
/**
* Injection token that references the `MatAutocompleteSelectedTrigger`.
* @docs-private
*/
export const MAT_AUTOCOMPLETE_SELECTED_TRIGGER = new InjectionToken<MatAutocompleteSelectedTrigger>(
'MatAutocompleteSelectedTrigger',
);
/**
* Used to provide a custom template for the selected option display in `mat-autocomplete`,
* similar to `mat-select-trigger` for `mat-select`. Place inside `<mat-autocomplete>`:
*
* ```html
* <mat-autocomplete>
* <ng-template matAutocompleteSelectedTrigger let-value>{{ value }}</ng-template>
* </mat-autocomplete>
* ```
*
* The `$implicit` template context variable is the raw selected value.
*/
@Directive({
selector: 'ng-template[matAutocompleteSelectedTrigger]',
providers: [
{provide: MAT_AUTOCOMPLETE_SELECTED_TRIGGER, useExisting: MatAutocompleteSelectedTrigger},
],
})
export class MatAutocompleteSelectedTrigger {
readonly templateRef = inject(TemplateRef);
}