-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Feature request : Autocomplete #2987
Comments
@diicar @kara http://plnkr.co/edit/3I7FW0EhLa90hVzExVNq?p=preview It was actually working before the commit |
@diicar In the plunker, it looks like you forgot to import the ReactiveFormsModule, so the directive isn't recognized. I was able to see what you mean once I added it though. If you wait a few seconds and then open the panel, everything is fine. But if you try to open the panel before the async result comes back, the panel closes itself immediately because the option list is empty. You can fix this by querying for the trigger and calling its It's not great to require you to do that though. Perhaps we should just keep the panel open when the option list is empty and just hide it... looking into a better way to handle this. |
@chouclee @kara I see, thank you 👍
It works, but I believe no one likes this solution. Could you give me an example using the query please? I tried like this
Anyway, thank you very much. |
@diicar Yeah, I'm working on a better solution right now. The best solution will probably come a bit later when we add more robust async support, with the progress bar, "not found" message, etc. Regarding the query, you'll have to wait for #2937 in order to refer to the @ViewChild(MdAutocompleteTrigger) trigger: MdAutocompleteTrigger; Then call this.trigger.openPanel() whenever your data comes in. |
@kara, as of 2.0.0-beta.2 how can I get the event that is triggered when the user selects one of the options in the list? |
|
@diicar thanks, but that's my current state. |
@gilad-vatbox I see, your values is a list of string? |
@diicar no, its an array of objects with a 'name' propery |
@gilad-vatbox I think what you're looking for is |
@kara yes! any idea when will this be included in a release? Or whether I have a way of accessing it now? |
If you use material-builds rather than the latest release, it should be in there now. It's based on master.
|
For what it's worth: I faced this same issue but it was being caused by a request being made outside Angular (a call to google maps api like described here) and the panel wasn't being shown when results came back. I had to send results to the observer being used to populate md-option within @Injectable()
export class MyService {
constructor(
private zone: NgZone
) { }
// method in myservice.ts which returns an observer used in *ngFor of md-option
getResults() {
return Observable.create(observer => {
// [...]
this.zone.run(() => {
observer.next(results);
observer.complete();
});
// [...]
});
} |
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. |
Bug, feature request, or proposal:
feature request
What is the expected behavior?
Display the options when ajax's response comes back
What is the current behavior?
I have to focus out the md-input-container and to focus again to see the proposed options
What are the steps to reproduce?
Can't make to work plunker with
<input mdInput " [mdAutocomplete]="reactive" [formControl]="stateCtrl">
Console error:
Can't bind to 'formControl' since it isn't a known property of 'input'
Plunker template: http://plnkr.co/edit/Vk3UGKnxKGRg3bNuKVHa?p=preview
Please see the plunker, maybe I'm doing something wrong...
Thank you
The text was updated successfully, but these errors were encountered: