Skip to content

on-search-change event don't stop working. #277

Open
@endigo

Description

@endigo

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);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions