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 25 restrict : 'E',
26 26 templateUrl : 'assets/js/angular/custom/directive/html/auto-complete.html',
27 27 controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
  28 +
  29 + $scope.appController = angular.element("#citapp-controller").scope();
28 30  
29 31 if($scope.id === undefined){
30 32 $scope.id = $attrs['ngModel'];
... ... @@ -85,7 +87,13 @@ citApp.directive("autoComplete", ["$translate", "$timeout", function($translate,
85 87 return [];
86 88 });
87 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  
... ...