Hey, guys. I’ve been implementing search function and it works perfectly on a web browser, but once I’ve built it on iOS it shows a black screen. Data is getting from API.
search.html
<ion-searchbar (ionInput)="getItems($event)" [showCancelButton]="true" (ionCancel)="closeSelf()"> </ion-searchbar>
<h3 left class='results'>Results</h3>
<div class="suggested-campaigns2">
<ion-list *ngIf="showResults">
<ion-item *ngFor="let item of campaigns" (click)=goToCampaign(item.id);>
<span>
{{ item.camp_title}}
</span>
</ion-item>
</ion-list>
Search.ts
constructor(public navCtrl: NavController,
private campaignsService: CampaignsService,
private toolbar: Toolbar) {
this.dataRefreshed();
}
// get search results
dataRefreshed(){
this.campaigns = JSON.parse(localStorage.getItem('campaigns_data'))
}
getItems(ev: any) {
this.dataRefreshed();
let val = ev.target.value;
if (val && val.trim() != '') {
this.campaigns = this.campaigns.filter((item) => {
return (item.camp_title.toLowerCase().indexOf(val.toLowerCase()) > -1);
});
this.showResults = true;
}
if (!val || val.trim() == ''){
this.showResults = true;
}
}
Any Ideas what could be the problem?
Thanks !