Open
Description
Hello,
I change $scope.items in on-search-change event. But a event is don't stop when $scope.items changed successfully.
Here is code:
var searchTimer = undefined;
$scope.onSearchItem = function(data) {
if(searchTimer)
$timeout.cancel(searchTimer);
searchTimer = $timeout(function(){
var selectedItems = $scope.items.filter(function(e){
return e.isCheck;
})
service.findItem(data.keyword).success(function (res1) {
$scope.items = selectedItems;
res1.forEach(function(newItem){
var isSelected = selectedItems.filter(function(oldItem){
return newItem.pkId === oldItem.pkId;
}).length > 0;
if(!isSelected)
$scope.items.push(newItem);
})
}).error(msgService.showError)
}, 300);
}