Commit 8c088fc687f4bcbac401f1e6f08be8df052888ec
1 parent
a98ca8d049
Exists in
master
- Modifiqué gulp para que uglifique despues de generar templates.
- Agregué método para procesar el cliente seleccionado. - Agregué on select al componente typeahead.
Showing
3 changed files
with
11 additions
and
7 deletions
 
Show diff stats
gulpfile.js
| ... | ... | @@ -28,7 +28,7 @@ gulp.task('templates', function() { | 
| 28 | 28 | ); | 
| 29 | 29 | }); | 
| 30 | 30 | |
| 31 | -gulp.task('uglify', function() { | |
| 31 | +gulp.task('uglify', ['templates'], function() { | |
| 32 | 32 | pump( | 
| 33 | 33 | [ | 
| 34 | 34 | gulp.src([ | 
| ... | ... | @@ -54,5 +54,3 @@ gulp.task('pre-commit', function() { | 
| 54 | 54 | ] | 
| 55 | 55 | ); | 
| 56 | 56 | }); | 
| 57 | - | |
| 58 | -gulp.task('compile', ['templates', 'uglify']); | 
src/js/controller.js
| ... | ... | @@ -9,6 +9,8 @@ angular.module('focaBusquedaCliente') | 
| 9 | 9 | templateUrl: 'foca-busqueda-cliente-modal.html', | 
| 10 | 10 | backdrop: false, | 
| 11 | 11 | controller: 'focaBusquedaClienteModalController' | 
| 12 | + }).result.then(function(cliente){ | |
| 13 | + console.log(cliente); | |
| 12 | 14 | }); | 
| 13 | 15 | }; | 
| 14 | 16 | } | 
| ... | ... | @@ -25,11 +27,14 @@ angular.module('focaBusquedaCliente') | 
| 25 | 27 | return datos.data; | 
| 26 | 28 | }); | 
| 27 | 29 | }; | 
| 30 | + $scope.seleccionar = function(cliente) { | |
| 31 | + $scope.cliente = cliente; | |
| 32 | + }; | |
| 28 | 33 | $scope.cancelar = function() { | 
| 29 | - $uibModalInstance.close(); | |
| 34 | + $uibModalInstance.dismiss(); | |
| 30 | 35 | }; | 
| 31 | - $scope.seleccionar = function() { | |
| 32 | - $uibModalInstance.close(); | |
| 36 | + $scope.aceptar = function() { | |
| 37 | + $uibModalInstance.close($scope.cliente); | |
| 33 | 38 | }; | 
| 34 | 39 | } | 
| 35 | 40 | ]); | 
src/views/foca-busqueda-cliente-modal.html
| ... | ... | @@ -18,6 +18,7 @@ | 
| 18 | 18 | typeahead-loading="cargandoClientes" | 
| 19 | 19 | typeahead-no-results="sinResultados" | 
| 20 | 20 | typeahead-min-length="3" | 
| 21 | + typeahead-on-select="seleccionar($item)" | |
| 21 | 22 | class="form-control" | 
| 22 | 23 | > | 
| 23 | 24 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 
| ... | ... | @@ -29,6 +30,6 @@ | 
| 29 | 30 | </form> | 
| 30 | 31 | </div> | 
| 31 | 32 | <div class="modal-footer"> | 
| 32 | - <button ng-click="seleccionar()">Seleccionar</button> | |
| 33 | + <button ng-click="aceptar()">Aceptar</button> | |
| 33 | 34 | <button ng-click="cancelar()">Cancelar</button> | 
| 34 | 35 | </div> | 
