title: ERROR TypeError: Cannot read property 'slice' of undefined at Search function - Angular 2+
body: <p>I have a <code>angular5-data-table</code> module that I am implementing. I was able to use its all functionalities. Additionally, I wanted to add a search functionality on it. I added the codes below (both html and typescript) and I started to receive <code>ERROR TypeError: Cannot read property 'slice' of undefined</code> error. </p>
  
  <p>My search html is:</p>
  
  <pre><code>&lt;input type="text" class="form-control input-md" placeholder="Search by full name" #query (keyup)="searchMember(query.value)" [(ngModel)]="filter.name"&gt;
  </code></pre>
  
  <p>And the code behind this <code>searchMember(query.value)</code> is:</p>
  
  <pre><code>searchMember(query: string) {
    let members = this.allMembers;
    if (this.filter.firstName) {
      members = members.filter(o =&gt; o.firstName.toLowerCase().includes(query.toLowerCase()));
   }
    this.members = members;
    this.initializeTable(this.members);
    console.log(members);
  }
  </code></pre>
  
  <p>Here is <code>initializeTable()</code>:</p>
  
  <pre><code>  private initializeTable(members: Member[]) {
      this.tableResource = new DataTableResource(members);
      this.tableResource.query({ offset: 0 }).then(items =&gt; this.items = items);
      this.tableResource.count().then(count =&gt; this.itemCount = count);
   }
  </code></pre>
  
  <p>And lastly, here are initializations:</p>
  
  <pre><code>filter: any = {};
  tableResource: DataTableResource&lt;Member&gt;;
  allMembers: Member[];
  </code></pre>
  
  <p>I am not sure I understood the error. Any thoughts?</p>