Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. getSearch(date, val){
  2. this.loading.present();
  3. this.news.searchQuery(date, val).subscribe(data => {
  4. this.search = data.noticias
  5. this.loading.dismiss();
  6. })
  7. }
  8.  
  9. getItems(ev: any) {
  10. // set val to the value of the searchbar
  11. let val = ev.target.value;
  12. this.getSearch(this.maxDate, val);
  13. // if the value is an empty string don't filter the items
  14. if (val && val.trim() != '') {
  15. this.data = this.search.filter((item) => {
  16. return (item.titulo.toLowerCase().indexOf(val.toLowerCase()) > -1);
  17. })
  18. }else{
  19. this.getData();
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement