Skip to content

md-autocomplete optionsSelection #3280

Closed
@ambarkiy

Description

@ambarkiy

What is the expected behavior?

I want to call a function when an option is selected. After some search it seem that i have to use :

property optionSelections of MdAutocompleteTrigger

In the documentation : https://material.angular.io/components/component/autocomplete optionSelections Stream of autocomplete option selections.

I dont understand that , what is a stream, how to implement this ?

What is the current behavior?

Iam able to have MdAutocompleteTrigger In my component i add : @ViewChild(MdAutocompleteTrigger) trigger:MdAutocompleteTrigger; ngAfterContentInit() { setTimeout(() =>this.trigger.openPanel()); } but i cannot use optionSelections, can someone can give me an example

I try this ngAfterContentInit() { setTimeout(() => Observable.merge(...this.trigger.optionSelections) .subscribe((option)=>console.log(option))); } but not working

Is there anything else we should know?

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