我有对象名称ReportControl,我遇到问题,我无法检查与此对象相关的值
如果列类型为1,则显示标签处于活动状态,否则显示标签在reportcomponent.html上处于非活动状态
对象ReportControl的数据如下
{"reportId":2028,"fieldName":"offilneURL","reportStatus":"HiddenColumn","columnType":1}
关于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
我需要检查列类型是否为1,然后显示带有活动文本的标签否则显示标签的文本无效。
带有文本的预期结果显示标签
*ngIf
<label *ngIf="ReportControl.columnType == 1">Active</label>
<label *ngIf="ReportControl.columnType == 0">Inactive</label>