Commit 07591c7c399f2504cbaf8acdc9e0eb692e11e157

Authored by Carlos Alberto
1 parent 3749adee
Exists in master

Inclusão do setLoading(true) durante a pesquisa da AutoCompleteDirective

cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/AutoCompleteDirective.js
@@ -25,6 +25,8 @@ citApp.directive("autoComplete", ["$translate", "$timeout", function($translate, @@ -25,6 +25,8 @@ citApp.directive("autoComplete", ["$translate", "$timeout", function($translate,
25 restrict : 'E', 25 restrict : 'E',
26 templateUrl : 'assets/js/angular/custom/directive/html/auto-complete.html', 26 templateUrl : 'assets/js/angular/custom/directive/html/auto-complete.html',
27 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { 27 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
  28 +
  29 + $scope.appController = angular.element("#citapp-controller").scope();
28 30
29 if($scope.id === undefined){ 31 if($scope.id === undefined){
30 $scope.id = $attrs['ngModel']; 32 $scope.id = $attrs['ngModel'];
@@ -85,7 +87,13 @@ citApp.directive("autoComplete", ["$translate", "$timeout", function($translate, @@ -85,7 +87,13 @@ citApp.directive("autoComplete", ["$translate", "$timeout", function($translate,
85 return []; 87 return [];
86 }); 88 });
87 }else{ 89 }else{
88 - return $scope.find({value : viewValue}); 90 + $scope.appController.setLoadingPesquisa(true);
  91 + return $scope.find({value : viewValue}).then(function(result) {
  92 + $scope.appController.setLoadingPesquisa(false);
  93 + return result;
  94 + }, function() {
  95 + $scope.appController.setLoadingPesquisa(false);
  96 + });
89 } 97 }
90 }; 98 };
91 99