在 Angularjs 中获取 ng-keypress 上文本框的值
Get value of textbox on ng-keypress in Angularjs
我想在按键时获取文本框的值。
我有 html 代码
<input style="width: 20%; float: right;"
ng-model="que.SelectedOptionsUID"
type="text"
ng-keypress="myFunct($event)"/>
以及我控制器上的 JS 代码:
$scope.myFunct = function (e) {
var charCode = (e.which) ? e.which : e.keyCode;
//i want here value of the textbox
}
<input style="width: 20%; float: right;"
ng-model="que.SelectedOptionsUID"
type="text"
ng-keypress="myFunct($event, que.SelectedOptionsUID)"/>
控制器:
$scope.myFunct = function (e, myValue) {
var charCode = (e.which) ? e.which : e.keyCode;
// do something with myValue
}
我想在按键时获取文本框的值。
我有 html 代码
<input style="width: 20%; float: right;"
ng-model="que.SelectedOptionsUID"
type="text"
ng-keypress="myFunct($event)"/>
以及我控制器上的 JS 代码:
$scope.myFunct = function (e) {
var charCode = (e.which) ? e.which : e.keyCode;
//i want here value of the textbox
}
<input style="width: 20%; float: right;"
ng-model="que.SelectedOptionsUID"
type="text"
ng-keypress="myFunct($event, que.SelectedOptionsUID)"/>
控制器:
$scope.myFunct = function (e, myValue) {
var charCode = (e.which) ? e.which : e.keyCode;
// do something with myValue
}