title: How to filter JSON data using Typescript / Javascript / Angular 4?
body: <p>I have json data like this </p>
  
  <pre><code>data :[
  {taskname:'chennai',    id:'maa' }
  {taskname:'mumbai',     id:'bom' }
  {taskname:'delhi',      id:'del' }
  ....
  ....
  ....
  {taskname:'salem',      id:'che'}
  {taskname:'bengaluru',  id:'blr'}
  {taskname:'chavvapet',  id:'chv'}
  }]
  </code></pre>
  
  <p>now i need to filter this data and return matching values (just like autocomplete). For example when i get value <strong>CH</strong> , first i need to check on <strong>ID</strong> and then on <strong>taskname</strong>. so the return value should be like this.
  must order ID matching top and then taksname matching.</p>
  
  <pre><code>{taskname:'salem',      id:'che'}
  {taskname:'chavvapet',  id:'chv'}
  {taskname:'chennai',    id:'maa'}
  </code></pre>
  
  <p>Incase if i get value CHE, then i need to return value like this</p>
  
  <pre><code>{taskname:'salem',      id:'che'  }
  {taskname:'chennai',    id:'maa'  }
  </code></pre>
  
  <p>Could someone please tell me how to do filter using typescript ?</p>
  
  <p><a href="https://stackoverflow.com/questions/23720988/how-to-filter-json-data-in-javascript-or-jquery">Tried few of this answer</a>, but no luck.</p>