Ts
this.myservice.online_service('online_service',data).subscribe(res=>{
this.result = res;
this.bus_data=this.result.searchResult;
})
Html
<ion-card *ngFor= "let bus of bus_data ; let i = index" [attr.data-target]="'#viewseat' + i" (click)="get_seats(i)">
<ion-card-header>
<ion-row>
<ion-col col-6 class="p0 bus_name">{{bus.operatorName}}</ion-col>
</ion-row>
</ion-card-header>
</ion-card>
service.ts
online_service(url,data = null )
{
this.show_loader();
return this.http.post(this.webservice_url+ url, JSON.stringify(data)).map(res=>res.json())
}
The code works well if server returns multiple data .But getting this error in case server return single data