Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getSearch(date, val){
- this.loading.present();
- this.news.searchQuery(date, val).subscribe(data => {
- this.search = data.noticias
- this.loading.dismiss();
- })
- }
- getItems(ev: any) {
- // set val to the value of the searchbar
- let val = ev.target.value;
- this.getSearch(this.maxDate, val);
- // if the value is an empty string don't filter the items
- if (val && val.trim() != '') {
- this.data = this.search.filter((item) => {
- return (item.titulo.toLowerCase().indexOf(val.toLowerCase()) > -1);
- })
- }else{
- this.getData();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement