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

angular.module('app.search', ['pascalprecht.translate'])
.controller('SearchCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
$scope.users=[];
$scope.travels=[];
$scope.search={
word:""
};
$scope.doSearch = function() {
console.log("doing search");
console.log($scope.search.word);
/* travels refresh: */
$http.get(urlapi + 'search/'+ $scope.search.word)
.then(function(data){
console.log('data success travels');
console.log(data); // for browser console
$scope.users = data.data.users; // for UI
$scope.travels = data.data.travels; // for UI
$scope.$broadcast('scroll.refreshComplete');//refresher stop
}, function(data){
console.log('data error');
$scope.$broadcast('scroll.refreshComplete');//refresher stop
$ionicLoading.show({ template: 'Search error, need text to search', noBackdrop: true, duration: 2000 });
});
};
});