Angular 4 - get input value

后端 未结 9 1559
抹茶落季
抹茶落季 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:19

    You can use (keyup) or (change) events, see example below:

    in HTML:

    
    

    Or

    
    

    in Component:

    change(event) {console.log(event.target.value);}
    

提交回复
热议问题