Skip to content

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

Closed

Description

@djleonskennedy

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",

Activity

  1. djleonskennedy commented on Mar 13, 2017

    @djleonskennedy
    Author

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

  2. chouclee commented on Mar 13, 2017

    @chouclee
    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>
    
  3. djleonskennedy commented on Mar 14, 2017

    @djleonskennedy
    Author

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

  4. willshowell commented on Mar 14, 2017

    @willshowell
    Contributor

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

  5. gtzinos commented on May 17, 2017

    @gtzinos
    Contributor

    Guys onSelect method not exists.

  6. rupinr commented on Jun 23, 2017

    @rupinr

    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?

  7. gauravbh1 commented on Jun 25, 2017

    @gauravbh1

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

  8. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions