-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(autocomplete): add isOpen attribute #7149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(autocomplete): add isOpen attribute #7149
Conversation
src/lib/autocomplete/autocomplete.ts
Outdated
@@ -57,6 +57,11 @@ export class MdAutocomplete implements AfterContentInit { | |||
/** Whether the autocomplete panel should be visible, depending on option length. */ | |||
showPanel = false; | |||
|
|||
_isOpen: boolean = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need this extra flag. isOpen
should be the same as this.showPanel && this.options.length > 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial thought as well, however, showPanel
is not set to false on blur
, which prevents it from working that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, also a final nit: can you add a doc string to the isOpen
getter so it shows up in the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not sure how I deleted the doc line I had for it.
@@ -66,19 +66,6 @@ | |||
</md-card> | |||
</div> | |||
|
|||
<md-autocomplete #reactiveAuto="mdAutocomplete" [displayWith]="displayFn"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these removed from the demo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are duplicates of the same elements above.
It look slike we had 5 <md-autocomplete>
s for 3 [mdAutocompleteTrigger]
s
src/lib/autocomplete/autocomplete.ts
Outdated
@@ -57,6 +57,11 @@ export class MdAutocomplete implements AfterContentInit { | |||
/** Whether the autocomplete panel should be visible, depending on option length. */ | |||
showPanel = false; | |||
|
|||
_isOpen: boolean = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
af86974
to
a674455
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Add isOpen attribute to `MdAutocomplete` component.
a674455
to
4ed1c13
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
For #5881