Get Value From Select Option in Angular 4

前端 未结 5 1127
难免孤独
难免孤独 2020-11-28 10:09

How do I get the value from the select option in Angular 4?

I want to assign it to a new variable in the component.ts file. I\'ve tried this but outputs nothing.

5条回答
  •  [愿得一人]
    2020-11-28 10:53

    You just need to put [(ngModel)] on your select element:

    
                            
        
    提交评论

提交回复
热议问题