Skip to content

autocomplete "(onItemSelected)"="do($event)" #3576

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

Closed
djleonskennedy opened this issue Mar 13, 2017 · 8 comments
Closed

autocomplete "(onItemSelected)"="do($event)" #3576

djleonskennedy opened this issue Mar 13, 2017 · 8 comments

Comments

@djleonskennedy
Copy link

Bug, feature request, or proposal:

feature request

What is the expected behavior?

@output() event on item selected

What is the current behavior?

not @output() event on item selected

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

I'm currently using breeze client, that allows to update property from ngModel only.
In this case one way to update property to listen if autocomplete item selected

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

"@angular": "~2.4.3",
"@angular/material": "^2.0.0-beta.2",

@djleonskennedy
Copy link
Author

md-option has onClose, it can be used as workaround

@chouclee
Copy link
Contributor

md-option has onSelect, is this what you want?

<md-autocomplete #appSearch="mdAutocomplete">
  <md-option *ngFor="let app of apps" [value]="app.name" (onSelect)="onAppSelect(app)">
    {{ app.name }}
  </md-option>
</md-autocomplete>

@djleonskennedy
Copy link
Author

@chouclee Yes, i've used md-option's onClose, it'd be nice to see it it in examples somewhere!

@willshowell
Copy link
Contributor

As a note, the api changes from onSelect to onSelectionChange in #2722 to account for select/deselect of multiple options.

@gtzinos
Copy link
Contributor

gtzinos commented May 17, 2017

Guys onSelect method not exists.

@rupinr
Copy link

rupinr commented Jun 23, 2017

I used onSelectionChange instead of onSelect.

<md-option (onSelectionChange)="test($item)" *ngFor="let option of filteredTrain | async"
[value]="option">
{{ option.viewValue }}

test(item){
console.log(item);
}.

But I only see undefined in console. Is there anything wrong here?

@gauravbh1
Copy link

@rupinr
Instead of (onSelectionChange)="test($item)" use (onSelectionChange)="test(option)"

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
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

6 participants