How to trigger a method when the user presses the delete or return key?
In my form I have a client field. I need that when the user presses the delete or return Key, a method that I have in my controller is triggered, how can I capture if one of these keys has been triggered?
I'm using AngularJs
This is my input:
<input placeholder="Digite as iniciais para fazer a pesquisa." class="md-input label-fixed" ng-model="registro2.razao"/>
2
Author: UzumakiArtanis, 2017-07-28
1 answers
Hello try adding the directive to your input:
ng-keydown="teclaPress($evento)"
And in your controller add function press key
$scope.teclaPress = function(ObjKey) {
// teu codigo por exemplo debug
console.log(ObjKey.key); // Tecla que clicaste
}
2
Author: 13dev, 2017-07-28 19:07:43