File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1212 #reactiveInput
1313 matInput
1414 [matAutocomplete] ="reactiveAuto "
15+ [matAutocompleteOverlayInlined] ="true "
1516 [formControl] ="stateCtrl "
1617 (input) ="reactiveStates = filterStates(reactiveInput.value) "
1718 (focus) ="reactiveStates = filterStates(reactiveInput.value) ">
7172 @if (true) {
7273 < mat-form-field [color] ="templateStatesTheme ">
7374 < mat-label > State</ mat-label >
74- < input matInput [matAutocomplete] ="tdAuto " [(ngModel)] ="currentState "
75+ < input matInput [matAutocomplete] ="tdAuto " [matAutocompleteOverlayInlined] =" true " [ (ngModel)] ="currentState "
7576 (ngModelChange) ="tdStates = filterStates(currentState) " [disabled] ="tdDisabled ">
7677 < mat-autocomplete #tdAuto ="matAutocomplete "
7778 [hideSingleSelectionIndicator] ="templateHideSingleSelectionIndicator "
132133 < input
133134 matInput
134135 [matAutocomplete] ="groupedAuto "
136+ [matAutocompleteOverlayInlined] ="true "
135137 [(ngModel)] ="currentGroupedState "
136138 (ngModelChange) ="filteredGroupedStates = filterStateGroups(currentGroupedState) ">
137139 </ mat-form-field >
Original file line number Diff line number Diff line change @@ -221,7 +221,9 @@ export class AutocompleteDemo {
221221 <p>Choose a T-shirt size.</p>
222222 <mat-form-field>
223223 <mat-label>T-Shirt Size</mat-label>
224- <input matInput [matAutocomplete]="tdAuto" [(ngModel)]="currentSize" name="size">
224+ <input
225+ matInput [matAutocomplete]="tdAuto" [matAutocompleteOverlayInlined]="true"
226+ [(ngModel)]="currentSize" name="size">
225227 <mat-autocomplete #tdAuto="matAutocomplete">
226228 @for (size of sizes; track size) {
227229 <mat-option [value]="size">{{size}}</mat-option>
Original file line number Diff line number Diff line change @@ -224,6 +224,12 @@ export class MatAutocompleteTrigger
224224 */
225225 @Input ( 'matAutocompletePosition' ) position : 'auto' | 'above' | 'below' = 'auto' ;
226226
227+ /**
228+ * Whether to inline the overlay, instead of using the global overlay container.
229+ */
230+ @Input ( { alias : 'matAutocompleteOverlayInlined' , transform : booleanAttribute } )
231+ overlayInlined : boolean ;
232+
227233 /**
228234 * Reference relative to which to position the autocomplete panel.
229235 * Defaults to the autocomplete trigger element.
@@ -894,6 +900,7 @@ export class MatAutocompleteTrigger
894900 backdropClass : this . _defaults ?. backdropClass || 'cdk-overlay-transparent-backdrop' ,
895901 panelClass : this . _overlayPanelClass ,
896902 disableAnimations : this . _animationsDisabled ,
903+ insertOverlayAfter : this . overlayInlined ? this . _getConnectedElement ( ) : undefined ,
897904 } ) ;
898905 }
899906
You can’t perform that action at this time.
0 commit comments