[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Using Angular 6, Material Design V6.4.7, the MatAutocompleteTrigger under AutoComplete has a method called openPanel() which is suppose to open the suggestion panel. But its not.
here is the link to stackblitz, please check the html file under the app folder, there is a button, when clicked, should open the panel.
https://stackblitz.com/edit/angular-rjebzg
Angular version: 6.1.0
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.11.1
The panel does open, but the issue is that it also binds a click event on the body which closes it immediately. You can work around it by calling openPanel in a timeout.
The panel does open, but the issue is that it also binds a
clickevent on thebodywhich closes it immediately. You can work around it by callingopenPanelin a timeout.
actually you can use $event.stopPropagation() as well to get it working.
please see this... https://stackblitz.com/edit/angular-rjebzg-nprmc7?file=app/autocomplete-overview-example.html
I had the same issue.
I wanted the panel to open with only an empty <mat-optgroup> with a label.
It seems that the panel won't open if there's no options (even if there are empty optgroup)
Adding a <mat-option style="display: none"></mat-option> did the trick.
@rishilongia 's solution works .
Most helpful comment
actually you can use $event.stopPropagation() as well to get it working.
please see this... https://stackblitz.com/edit/angular-rjebzg-nprmc7?file=app/autocomplete-overview-example.html