Hi all I’m stuck in a situation and need help.
What I’m trying to do is I want to disable the button if the application status is approved or rejected and enable if the status is pending, but unable to do so…
Ant help is appreciated.
<ion-content>
<ion-card *ngFor="let obj of responseObj;">
<ion-list>
<ion-item>
User: {{obj.uid}}
</ion-item>
<ion-item>
Status: {{obj.Status}}
</ion-item>
<ion-item>
Approved/Rejected By: {{obj.ApprovedBy}}
</ion-item>
<div style="text-align: center">
<button ion-button [disabled]="!isenabled" (click)="appRej(obj.id, obj.uid, obj.type, obj.SataDate, obj.EndDate, obj.reason, obj.Status)">Approve/Reject</button>
</div>
</ion-list>
</ion-card>
</ion-content>
ts:
ionViewDidLoad() {
this.http.get("http://api.leave_dtls.php").subscribe(data => {
console.log("Got Leave List");
this.data = data.json();
var response = JSON.parse(data["_body"]);
this.responseObj = response.response_data;
console.log(this.responseObj.itemStatus);
for (var i = 0; i < this.responseObj.length; i++) {
console.log(this.responseObj[i].Status);
if(this.responseObj[i].Status == 'PENDING'){
this.isenabled = true;
}
else{
this.isenabled = false;
}
}
});
}