Commit a757865ff7f24ce85a78111ad2c52da382936e6c

Authored by Eric Fernandez
1 parent 50a0d78717
Exists in master

recibo id transportista como parámetro

Showing 2 changed files with 9 additions and 5 deletions   Show diff stats
src/js/controller.js
... ... @@ -6,10 +6,10 @@ angular.module('focaModalVehiculo')
6 6 '$scope',
7 7 '$uibModalInstance',
8 8 'focaModalVehiculoService',
  9 + 'idTransportista',
9 10 function($timeout, $filter, $scope, $uibModalInstance,
10   - focaModalVehiculoService
  11 + focaModalVehiculoService, idTransportista
11 12 ) {
12   -
13 13 $scope.filters = '';
14 14 $scope.vehiculos = [];
15 15 $scope.primerBusqueda = false;
... ... @@ -25,7 +25,7 @@ angular.module('focaModalVehiculo')
25 25 $scope.busquedaPress = function(key) {
26 26 if (key === 13) {
27 27 $scope.searchLoading = true;
28   - focaModalVehiculoService.getVehiculos().then(llenarDatos);
  28 + focaModalVehiculoService.getVehiculos(idTransportista).then(llenarDatos);
29 29 }
30 30 };
31 31 function llenarDatos(res) {
... ... @@ -4,8 +4,12 @@ angular.module('focaModalVehiculo')
4 4 'API_ENDPOINT',
5 5 function($http, API_ENDPOINT) {
6 6 return {
7   - getVehiculos: function() {
8   - return $http.get(API_ENDPOINT.URL + '/vehiculo');
  7 + getVehiculos: function(idTransportista) {
  8 + var transportista = '';
  9 + if(idTransportista !== -1) {
  10 + transportista = '/transportista/' + idTransportista;
  11 + }
  12 + return $http.get(API_ENDPOINT.URL + '/vehiculo' + transportista);
9 13 }
10 14 };
11 15 }