You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

7 years ago
  1. angular.module('app.search', ['pascalprecht.translate'])
  2. .controller('SearchCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
  3. $scope.users=[];
  4. $scope.travels=[];
  5. $scope.search={
  6. word:""
  7. };
  8. $scope.doSearch = function() {
  9. console.log("doing search");
  10. console.log($scope.search.word);
  11. /* travels refresh: */
  12. $http.get(urlapi + 'search/'+ $scope.search.word)
  13. .then(function(data){
  14. console.log('data success travels');
  15. console.log(data); // for browser console
  16. $scope.users = data.data.users; // for UI
  17. $scope.travels = data.data.travels; // for UI
  18. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  19. }, function(data){
  20. console.log('data error');
  21. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  22. $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
  23. });
  24. };
  25. });