Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

md-autocomplete binding to md-items #7074

Closed
postama opened this issue Feb 8, 2016 · 4 comments
Closed

md-autocomplete binding to md-items #7074

postama opened this issue Feb 8, 2016 · 4 comments

Comments

@postama
Copy link

postama commented Feb 8, 2016

Binding md-autocompletes md-items to an empty array or object, then clicking into md-autocomplete will cause md-autocomplete to not function property even after md-items are populated until a reload.

http://codepen.io/anon/pen/Gowjmv?editors=1010

@devversion
Copy link
Member

@postama You are not specifying an array. ($scope.autocompleteItems = {};)

  • This is a JSON-Object which will be detected as a promise (so the autocomplete thinks this is an async request)

So, you should fix this by changing {} to [], which is an empty array.

Demo with the fix: http://codepen.io/DevVersion/pen/vLQQvO?editors=1010

@postama
Copy link
Author

postama commented Feb 9, 2016

@devversion

Thanks for your response. This bug happens if you initialize the $scope.autoCompleteItems with all Javascript types except array. Should it maybe have different detection on whether or not it is a promise? Either way, I don't think the control breaking and requiring a reload to fix a great experience. I would expect it to not work with bad values, but as soon as it holds good values (an array) I would expect it to work.

devversion added a commit to devversion/material that referenced this issue Feb 9, 2016
At the moment the autocomplete will handle the results wrong.
So if we specify for example an empty JSON-Object, the autocomplete will handle the results as an async promise.

Fixes angular#7074
@devversion
Copy link
Member

@postama Just created a PR, works great now 👍 - #7089

@postama
Copy link
Author

postama commented Feb 9, 2016

@devversion Great, thanks for your help!

ThomasBurleson pushed a commit that referenced this issue Apr 1, 2016
At the moment the autocomplete will handle the results wrong.
So if we specify for example an empty JSON-Object, the autocomplete will handle the results as an async promise.

Fixes #7074

Closes #7089

# Conflicts:
#	src/components/autocomplete/autocomplete.spec.js
ThomasBurleson pushed a commit that referenced this issue Apr 1, 2016
At the moment the autocomplete will handle the results wrong.
So if we specify for example an empty JSON-Object, the autocomplete will handle the results as an async promise.

Fixes #7074

Closes #7089

# Conflicts:
#	src/components/autocomplete/autocomplete.spec.js
gmoothart pushed a commit to gmoothart/material that referenced this issue Apr 5, 2016
At the moment the autocomplete will handle the results wrong.
So if we specify for example an empty JSON-Object, the autocomplete will handle the results as an async promise.

Fixes angular#7074

Closes angular#7089
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants