Guest User

Untitled

a guest
Mar 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. $scope.SearchProvider = function(searchParam){
  2. try{
  3. $scope.searchMode = 1;
  4. var queryString='';
  5. if($scope.formModel && $scope.formModel !== searchParam){
  6. $scope.resultsCount = 0;
  7. currentPage = 1;
  8. }
  9. if(searchParam){
  10. $scope.formModel = searchParam;
  11. for(var param in searchParam){
  12. if(searchParam.hasOwnProperty(param)){
  13. var paramValue = searchParam[param].value ? searchParam[param].value.trim() : searchParam[param].trim();
  14. if (paramValue.length > 0)
  15. queryString += param + '=' + paramValue + '&';
  16. }
  17. }
  18. }
  19. //debugger;
  20. console.log(queryString);
  21. queryString= '?' + queryString + 'currentpage=' + $scope.currentPage;
  22.  
  23. $http.get("/includes/ReturnProvidersList.cfm" + queryString)
  24. .then(function(response){
  25. $scope.providers = response.data.provider;
  26. $scope.resultsCount = response.data.rowCount;
  27. if (!$scope.providers){
  28. $scope.NoResults = true;
  29. $scope.ShowResults = false;
  30. $scope.ShowDesc = false;
  31. $location.hash('error');
  32.  
  33. // call $anchorScroll()
  34. $anchorScroll('error');
  35. }
  36. else if($scope.providers){
  37. $scope.NoResults = false;
  38. $scope.ShowResults = true;
  39. $scope.ShowDesc = false;
  40. $location.hash('ResultsAnchor');
  41.  
  42. // call $anchorScroll()
  43. $anchorScroll('ResultsAnchor');
  44. }
  45. else{
  46. $scope.NoResults = false;
  47. $scope.ShowResults = false;
  48. $scope.ShowDesc = true;
  49. $location.hash('noScroll');
  50.  
  51. // call $anchorScroll()
  52. $anchorScroll('noScroll');
  53. }
  54. })
  55. }
  56. catch(err){ alert('No response.: ' + err.message); }
  57. }
Add Comment
Please, Sign In to add comment