How to stop mat-autocomplete to take custom user input values apart from given options?

后端 未结 5 1282
你的背包
你的背包 2021-02-12 20:22

I am using mat-auto complete component from material.angular.io. The default behavior is user can input any value as well as it gives options to choose from. Also you can add yo

5条回答
  •  一生所求
    2021-02-12 20:44

    As already suggested in comment by @trichetriche this is a use case for select.

    You can use material version of select, like this

    
      
        
          {{ food.viewValue }}
        
      
    
    

    If you need filter above the select, than I suggest to you PrimeNg Dropdown https://www.primefaces.org/primeng/#/dropdown

提交回复
热议问题