search.js 674 B

123456789101112131415161718192021222324
  1. var myApp = angular.module('myApp');
  2. myApp.controller('SearchController', ['$scope', '$http', '$location', '$routeParams', function($scope, $http, $location, $routeParams){
  3. console.log('SearchController loaded...');
  4. $scope.data = {
  5. searchTerm: "",
  6. countryCheck: false
  7. };
  8. $scope.searchResults = [];
  9. $scope.search = function(){
  10. angular.element('*[id^="tviz"]').remove();
  11. var extraParams = "&num=30";
  12. extraParams += ($scope.data.countryCheck) ? "&country=de" : "";
  13. $http.get('/crawler/apps/?q='+ $scope.data.searchTerm + extraParams).then(function(response){
  14. console.log(response.data);
  15. $scope.searchResults = response.data.results;
  16. });
  17. }
  18. }]);