Commit 0a1b3d1b60894e0c0784fb28b179772039d3476d
1 parent
14a894e0b1
Exists in
master
and in
1 other branch
focus en descripcion al crear, guardar con enter
Showing
2 changed files
with
7 additions
and
3 deletions
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -55,8 +55,9 @@ angular.module('focaModalPuntoDescarga') | 
| 55 | 55 | } | 
| 56 | 56 | }; | 
| 57 | 57 | |
| 58 | - $scope.guardar = function() { | |
| 59 | - focaModalPuntoDescargaService | |
| 58 | + $scope.guardar = function(key) { | |
| 59 | + if(key === 13) { | |
| 60 | + focaModalPuntoDescargaService | |
| 60 | 61 | .guardarPuntoDescarga($scope.puntoDescarga) | 
| 61 | 62 | .then(function() { | 
| 62 | 63 | actualizarTabla(); | 
| ... | ... | @@ -70,6 +71,7 @@ angular.module('focaModalPuntoDescarga') | 
| 70 | 71 | }; | 
| 71 | 72 | $scope.editando = false; | 
| 72 | 73 | }); | 
| 74 | + } | |
| 73 | 75 | }; | 
| 74 | 76 | |
| 75 | 77 | $scope.editar = function(id) { | 
src/views/modal-punto-descarga.html
| ... | ... | @@ -174,6 +174,8 @@ | 
| 174 | 174 | type="text" | 
| 175 | 175 | class="form-control form-control-sm" | 
| 176 | 176 | ng-model="puntoDescarga.descripcion" | 
| 177 | + foca-focus="ingreso" | |
| 178 | + ng-keypress="guardar($event.keyCode)" | |
| 177 | 179 | uppercase-only> | 
| 178 | 180 | </div> | 
| 179 | 181 | </div> | 
| ... | ... | @@ -221,6 +223,6 @@ | 
| 221 | 223 | <button | 
| 222 | 224 | class="btn btn-sm btn-primary my-1" | 
| 223 | 225 | type="button" | 
| 224 | - ng-click="guardar()" | |
| 226 | + ng-click="guardar(13)" | |
| 225 | 227 | ng-show="ingreso">Guardar</button> | 
| 226 | 228 | </div> |