Added delay before fetch data

This commit is contained in:
Jesús Ángel González 2018-05-10 13:03:08 +02:00 committed by Javier Castro
parent 64c25610b0
commit 806d6659a5
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<div layout="row" flex class="wz-margin-bottom-10">
<input ng-if="!isdisabled" flex id="query" placeholder="{{ placetext }}" ng-class="height ? height : ''" type="text" ng-model="term" ng-change="data.addFilter('search', term)"
<input ng-if="!isdisabled" flex id="query" placeholder="{{ placetext }}" ng-class="height ? height : ''" type="text" ng-model="term" ng-change="applyDelayAndFilter()"
class="wz-search-bar-size groupsNoMarginTop input-filter-box wz-width-100" />
<input ng-if="isdisabled" disabled flex id="query" placeholder="{{ placetext }}" ng-class="height ? height : ''" type="text" ng-model="term" ng-change="data.addFilter('search', term)"
<input ng-if="isdisabled" disabled flex id="query" placeholder="{{ placetext }}" ng-class="height ? height : ''" type="text" ng-model="term" ng-change="applyDelayAndFilter()"
class="wz-search-bar-size groupsNoMarginTop input-filter-box wz-width-100" />
</div>

View File

@ -26,7 +26,9 @@ app.directive('wzSearchBar', function() {
isdisabled: '=isdisabled'
},
link: function(scope, ele, attrs) {
scope.applyDelayAndFilter = () => {
setTimeout(() => scope.data.addFilter('search', scope.term),200)
}
},
template: searchBarTemplate
}