title: Search Bar in ionic "cannot read property srcElement undefined"
body: <pre><code>initializeItems()
  
   {
  
      this.items = this.productos;
  
   }
  
  getItems(searchbar)
  
   {
  
      this.initializeItems();
  
      // set q to the value of the searchbar
  
   var q = searchbar.srcElement.value;
  
      // if the value is an empty string don't filter the items
  
   if (!q) {
  
        return;
  
      }
  
      this.productos = this.productos.filter((v) =&gt; 
  
  {
  
   if(v.name &amp;&amp; q) 
  
  {
          if (v.name.toLowerCase().indexOf(q.toLowerCase()) &gt; -1) {
  
          return true;
  
   }
  
          return false;
  
        }
  
   });
  
      console.log(q, this.productos.length);
  
    }
  </code></pre>
  
  <p>This is the code for Search bar but when I type something in search input I am getting error as cannot read property srcElement undefined . </p>