Commit bbb0a9f6740802eec356c44e47e68a78425d1e91

Authored by Eric Fernandez
1 parent a55611890e
Exists in master

Primera búsqueda realizada en promesa cumplida

Showing 2 changed files with 5 additions and 4 deletions   Show diff stats
... ... @@ -39,7 +39,7 @@
39 39 templateUrl: 'src/views/modal-busqueda-productos.html',
40 40 controller: 'modalBusquedaProductosCtrl',
41 41 size: 'lg',
42   - resolve: {idLista : function() { return null; }}
  42 + resolve: {idLista : function() { return -1; }}
43 43 }
44 44 );
45 45  
src/js/controller.js
... ... @@ -21,19 +21,20 @@ angular.module('focaBusquedaProductos')
21 21 //METODOS
22 22 $scope.busquedaPress = function(key) {
23 23 if (key === 13) {
24   - $scope.primerBusqueda = true;
25   - if(idLista) {
  24 + if(idLista > 0) {
26 25 focaBusquedaProductosService
27 26 .getProductosByIdLista(idLista, $scope.filters)
28 27 .then(
29 28 function(res) {
  29 + $scope.primerBusqueda = true;
30 30 $scope.productos = res.data;
31 31 $scope.search();
32 32 }
33 33 );
34   - } else {
  34 + } else if(idLista === -1) {
35 35 focaBusquedaProductosService.getProductos().then(
36 36 function(res) {
  37 + $scope.primerBusqueda = true;
37 38 $scope.productos = res.data;
38 39 $scope.search();
39 40 primera();