Components: Add public api to autocomplete to check whether it is open

Created on 19 Jul 2017  路  8Comments  路  Source: angular/components

There is no public api users can consume that tells them whether an autocomplete is open on MdAutocomplete. We should add one.

P3 feature help wanted

All 8 comments

Hi @jelbourn, I'd like to work on that feature.

We have some emitters for the select component such as onOpen and onClose.
I wonder if that would be the best approach or should we publicly export the property showPanel?

Thanks

@leocaseiro I was just imagining an isOpen property on MdAutocomplete

This can already be done with the panelOpen property on MdAutocompleteTrigger. I updated this Plunker to prove myself it works.

@jelbourn, do you want to offer it directly in the MdAutocomplete, or should this be fine?

@carlos- Can't speak for the original intent, but I think this would be nice

<md-autocomplete #auto="mdAutocomplete">
  <md-option *ngFor="let state of filteredStates | async" [value]="state">
    {{ state }}
  </md-option>
</md-autocomplete>

isOpen: {{auto.isOpen}}

since it would eliminate the need for this:

@ViewChild(MdAutocompleteTrigger) trigger: MdAutocompleteTrigger;

isOpen() {
  return this.trigger.panelOpen
}

@willshowell, I totally agree. On the other hand, the same could apply to openPanel and closePanel. Right?

@carlos- Thanks for the tip on using MdAutocompleteTrigger. I am using it successfully for one Autocomplete on the page. How can I use it with multiple Autocompletes on the same page?

Fixed by #7149

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanpurple picture alanpurple  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

LoganDupont picture LoganDupont  路  3Comments

theunreal picture theunreal  路  3Comments

xtianus79 picture xtianus79  路  3Comments