Friends,
I tried to search for two fields and show the result on same page , but during search “No result” message can see in background. All data come fine from provider.
My template is
my template is like
<ion-content padding>
<h4 style="color:#F00" *ngIf="!connectivityFlag">You are offline, please be online to know building status </h4>
<form [formGroup]="formgroup" >
<ion-item>
<ion-label stacked>Inward No</ion-label>
<ion-input type="text" formControlName="inwardno" [(ngModel)]="data.inwardno" [disabled]="!connectivityFlag" ></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>Year</ion-label>
<ion-input type="text" formControlName="year" [(ngModel)]="data.year" [disabled]="!connectivityFlag" ></ion-input>
</ion-item>
<button ion-button block round [disabled]="!inwardno.valid||!year.valid" (click)="getFileStatus()">Search</button>
</form>
<div style="text-align:center" *ngIf="searchFlag && !dataFlag">
<br /><br />
<b>No search results , please try again</b>
</div>
<br/>
<br/>
<div class="box-header" *ngIf="searchFlag && dataFlag">
<div class="box-header">
<h3 class="box-title">File Status Details</h3>
</div>
<div class="box-body no-padding">
<table class="table table-striped">
<tbody>
<tr>
<td>Date Received</td>
<td>{{Date}}</td>
</tr>
<tr>
<td>Inward No</td>
<td>{{FileNo}}</td>
</tr>
<tr>
<td>Local Body Name <br/> </td>
<td>{{lbname}}</td>
</tr>
<tr>
<td>Address</td>
<td>{{ApplicantAddress}}</td>
</tr>
<tr>
<td>Locality</td>
<td>{{ApplicantLocality}}</td>
</tr>
<tr>
<td>File Status</td>
<td>{{FileStatus}}</td>
</tr>
<tr>
<td>Seat</td>
<td>{{seat}}</td>
</tr>
<tr>
<td>File ID</td>
<td>{{FileID}}</td>
</tr>
My contrller function is
getFileStatus ()
{
//alert(this.data.efileno);
var inwardno = this.data.inwardno;
var year = this.data.year;
var lbid = this.lb;
//alert("lbid:"+lbid+"yr:"+year+"inwno:"+inwardno);
//this.dataFlag = false;
this.searchFlag = true;
if(this.global1.getnetwork())
{
let loader = this.loadingController.create({
content: "Loading Result ... "
});
loader.present();
this.statusProvider.getFileStatus(lbid,inwardno,year)
.then(data => {
//alert(JSON.stringify(data));
if(data)
{
//alert("inside IF");
this.dataFlag = true;
this.LBID = data[0].intLBID;
this.ApplicantAddress = data[0].Address;
this.ApplicantLocality = data[0].Locality;
this.Date = data[0].dtDateofReceipt;
this.FileStatus = data[0].StatusEng;
this.FileID = data[0].intFileID;
this.seat = data[0].chvSeat;
this.FileNo = data[0].chvFileNo;
loader.dismiss();
} else {
this.dataFlag = false;
this.searchFlag = true;
loader.dismiss();
}
loader.dismiss();
});
loader.dismiss();
this.dataFlag = false;
this.searchFlag = true;
} else {
//alert("You are offline, please be online to know building permit status");
this.presentAlert();
}
}
Please help how it can make proper
Thanks