2017-04-25 70 views
0

我有一個簡單的搜索文本框和值改變,我在調用這個函數(我用Lodash)角2無法讀取屬性未定義

onKeyCustomerSearch(event: any) { 

    this.SearchCustomerString = event.target.value; 

    this.customersView = _.clone(this.customersArray); 
    this.customersView.paginatedCustomers = _.filter(this.customersView.paginatedCustomers, function (x) { 
     return x.BusinessName.includes(this.SearchCustomerString); 
    }); 
    } 

我越來越無法讀取的不確定

財產「SearchCustomerString」

但是,這是工作!

onKeyCustomerSearch(event: any) { 

    this.customersView = _.clone(this.customersArray); 
    this.customersView.paginatedCustomers = _.filter(this.customersView.paginatedCustomers, function (x) { 
     return x.BusinessName.includes(event.target.value); 
    }); 
    } 

回答

相關問題