Mat-autocomplete - How to access selected option?

前端 未结 3 1873
天涯浪人
天涯浪人 2021-01-01 08:39

I know that [value] stores the selected Object (Offer in my case). According to materials documentation, optionSelected emits an event. I tried

3条回答
  •  灰色年华
    2021-01-01 09:08

    It can we done in two ways

    1) Using onSelectionChange which emits MatOptionSelectionChange from mat-option

    
        
          {{ option }}
        
    
    

    2) Using optionSelected which emits MatAutocompleteSelectedEvent from mat-autocomplete

    
        
          {{ option }}
        
    
    

提交回复
热议问题