Use MatAutocomple without MatInput
See original GitHub issueI want to use MatAutocomplete on a bootstrap-styled input. Unfortunately, being able to use MatAutocomplete requires surrounding the input with a mat-form-field and giving the input itself a matInput-directive.
I was wondering if it is possible to avoid using
- mat-form-field
- matInput
- or at least use them in a “headless-mode” so they handle things like focus and model change subscriptions, but do not edit the template
The original mat-input is just too big and too interactive for many use cases. I am sure many people would like to replace it’s style.
By the way, if the matInput directive is missing, you get the very misleading message
UiBootstrapSearchComponent.html:8 ERROR Error: mat-form-field must contain a MatFormFieldControl.
at getMatFormFieldMissingControlError (form-field.es5.js:119)
at MatFormField.push.../../node_modules/@angular/material/esm5/form-field.es5.js.MatFormField._validateControlChild (form-field.es5.js:771)
at MatFormField.push.../../node_modules/@angular/material/esm5/form-field.es5.js.MatFormField.ngAfterContentInit (form-field.es5.js:453)
at callProviderLifecycles (core.js:22409)
at callElementProvidersLifecycles (core.js:22390)
at callLifecycleHooksChildrenFirst (core.js:22380)
at checkAndUpdateView (core.js:23311)
at callViewAction (core.js:23548)
at execComponentViewsAction (core.js:23490)
at checkAndUpdateView (core.js:23313)
even though it is matInput and not [formControl] missing
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using Angular Material mat-autocomplete without ReactiveForm
1. when something is typed in the mat-input , make an Ajax call to retrieve a list of users · 2. Display the...
Read more >Use MatAutocomple without MatInput · Issue #15684 - GitHub
I want to use MatAutocomplete on a bootstrap-styled input. Unfortunately, being able to use MatAutocomplete requires surrounding the input ...
Read more >Autocomplete | Angular Material
The autocomplete is a normal text input enhanced by a panel of suggested options. link Simple autocomplete. Start by creating the autocomplete panel...
Read more >Autocomplete overview - StackBlitz
<input matInput placeholder="State". aria-label="State" [matAutocomplete]. ="auto" [formControl]="stateCtrl"> ... Use of this source code is governed by an.
Read more >Angular 13 Autocomplete Tutorial with Angular Material
Today we are going to create Autocomplete in Angular 11 using ... to use such as MatAutocompleteModule and MatInputModule directives.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since you removed the
matInput
, you also have to remove themat-form-field
around it.matInput
is used as a way to tellmat-form-field
that an input is tied to it.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.