角度4-获取输入值 [英] Angular 4 - get input value
本文介绍了角度4-获取输入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何从角度4的输入中获取值. 我查看了有关angular的文档,并且带有按键事件的示例对我来说不太好,并且我找不到合适的示例来实现此目的,所以请帮帮我
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 me and I can't find a proper example how to do this so please help me out
问题: 我尝试读取输入的值,然后将值提交到另一个组件,该组件会将值添加到选择标签(例如,将人名发送到选择标签的列表中)
The problem: I try to read the input's value and after submiting the value to another component that will add the value to a select tag(e.g. send the name of the person to a list for a select tag)
推荐答案
<form (submit)="onSubmit()">
<input [(ngModel)]="playerName">
</form>
let playerName: string;
onSubmit() {
return this.playerName;
}
这篇关于角度4-获取输入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文