question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng-template inside MatAutocomplete doesn't work

See original GitHub issue

Reproduction

https://stackblitz.com/edit/angular-wwwm2h

Steps to reproduce:

  1. 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
fetiscommented, Jan 31, 2020

ok, I see. Thanks for explanation

1reaction
crisbetocommented, Jan 31, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found