Reputation: 978
I'm trying to create a button that both clears an mdAutocomplete control and opens the panel.
Something like this:
clearValue() {
this.stateCtrl.setValue("");
this.trigger.openPanel();
}
here is a plunk for the full code: https://plnkr.co/edit/KC8f1bHaDpWXEkLxzLta?p=preview
If I put a break point in the clearValue
function and call this.trigger.openPanel()
in the console the panel opens, but when I just let the code run the panel never opens.
Upvotes: 1
Views: 308
Reputation: 214235
The easist way to solve your problem is to prevent propagation to handler that closes popup:
(click)="clearValue(); $event.stopPropagation()"
Upvotes: 2