ng-template inside MatAutocomplete doesn't work
See original GitHub issueReproduction
https://stackblitz.com/edit/angular-wwwm2h
Steps to reproduce:
- Click on the input field
Expected Behavior
Autocomplete list is rendered on input click
Actual Behavior
Nothing is rendered
If you uncomment extra mat-option
then list appears. I think ii’s connected with the fact that autocomplete is unable to determine the number of options if they’re coming from ng-template
Environment
- Angular: 8.2.14
- CDK/Material: 8.2.3
- Browser(s): any
- Operating System (e.g. Windows, macOS, Ubuntu): any
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
mat-autocomplete inside an ng-template - Stack Overflow
I have a component that should choose beetween two mat-autocomplete depending an input value. Both mat-autocomplete works without the ngIf, ...
Read more >Autocomplete | Angular Material
Start by creating the autocomplete panel and the options displayed inside it. Each option should be defined by a mat-option tag. Set each...
Read more >Autocomplete with Angular InstantSearch - Algolia
This guide shows you how to create a search box which displays an autocomplete menu linked to a results page. The guide doesn't...
Read more >Angular Material Filtering Autocomplete with Required Selection
Unfortunately, it doesn't really auto-complete or select anything at all, and it doesn't force selection to be one of the items in your...
Read more >Advanced Angular: Implementing a Reusable Autocomplete ...
When using ng-content , the host doesn't have any control over the content. This behavior can lead to unexpected side-effects, as Angular will ......
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
ok, I see. Thanks for explanation
It’s definitely a framework limitation, but I’m not sure that it’s a bug since this is the way it has always worked.