I have object name ReportControl I face issue I cannot check value related to this object
if have column type 1 then display label active else display label not active on reportcomponent.html
data of object ReportControl as below
{"reportId":2028,"fieldName":"offilneURL","reportStatus":"HiddenColumn","columnType":1}
on reportcomponent.ts
this._displayreport.GetReportControl(param2).subscribe((res: any) => {
this.ReportControl = res;
console.log("report control is" + JSON.stringify(this.ReportControl) );
});
on service.ts
GetReportControl(id : string){
return this.http.get<any[]>(this.url+ 'report/GetAllReportControl/id=' + id)
.map(res=>res);
}
reportcomponent.html
I need to check if column type = 1 then display label with text active else display label with text not active.
Expected result display label with text active
This is how you display text conditionally in html, Is this what you expect?
<label>{{ReportControl.columnType == 1 ? 'Active' : 'Inactive'}}</label>
Using *ngIf
<label *ngIf="ReportControl.columnType == 1">Active</label>
<label *ngIf="ReportControl.columnType == 0">Inactive</label>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.