diff -r 8e26a5511bb8 -r 4d01c2d04359 client/app/search/search_controller.js --- a/client/app/search/search_controller.js Thu Jul 16 15:14:27 2015 +0200 +++ b/client/app/search/search_controller.js Thu Oct 01 17:55:23 2015 +0200 @@ -9,9 +9,12 @@ controller: 'searchCtrl' }); }) - .controller('searchCtrl', function($scope, $location, $routeParams, searchApi, $modal, Slide){ + .controller('searchCtrl', function($scope, $location, $routeParams, searchApi, searchApi2, $modal, Slide){ $scope.q = $routeParams.q || ''; - $scope.results = searchApi.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'10', callback: 'JSON_CALLBACK'}).getJsonp(); + if ($scope.q !== ''){ + $scope.results_ = searchApi.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'10', callback: 'JSON_CALLBACK'}).getJsonp(); + $scope.results = searchApi2.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'10', callback: 'JSON_CALLBACK'}).getJsonp(); + } $scope.toggleModal = function (index) { @@ -24,7 +27,7 @@ modalInstance.result.then(function (idBook) { var newSlide = { book: idBook, - id_inventory: $scope.results.hits[index].metas_dict.inventorynumber + research_id: $scope.results.hits[index].metas_dict.inventorynumber }; Slide.save(newSlide); });