Angular 4 - get input value

后端 未结 9 1809
抹茶落季
抹茶落季 2021-02-01 00:41

I would like to know how to get the value from an input on angular 4. I looked over the documentation on angular and the example with the key event doesn\'t work very well for m

9条回答
  •  没有蜡笔的小新
    2021-02-01 01:18

    If you want to read only one field value, I think, using the template reference variables is the easiest way

    Template

    
    
    
    
    **Component** 
     
    callPhone(phone): void 
    {
      
    console.log(phone);
    
    }
    

    If you have a number of fields, using the reactive form one of the best ways.

提交回复
热议问题