Skip to content

md-autocomplete error when using *ngIf in md-input-container #3269

Closed
@Poledouris

Description

@Poledouris

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Drop down shows and no error is thrown

What is the current behavior?

Drop down is not shown, and an error is thrown in Chrome Dev Tools:

  • "Cannot read property 'toArray' of undefined"

What are the steps to reproduce?

Inside the md-input-container tag include an *ngIf directive
Plunker based off Material Example for Autocomplete:
https://plnkr.co/edit/AYx6dvqxMARf3WcgrX6x?p=preview

What is the use-case or motivation for changing an existing behavior?

It should work

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.4.8, Material Beta 2

Is there anything else we should know?

I have found a couple workarounds, but neither are ideal:

  • put the *ngIf directive in a span around the md-input-control (shouldn't be necessary)
  • put the md-autocomplete into the md-input-container (if this is the proper solution, I think demos should be updated and implemented in this manner.)

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions