我有对象名称 报告控制 我遇到问题 我无法检查与此对象相关的值如果列类型为 1,则显示标签处于活动状态,否则在报表组件上显示标签未处于活动状态.html对象数据报告控制如下{"reportId":2028,"fieldName":"offilneURL","reportStatus":"HiddenColumn","columnType":1}on reportcomponent.tsthis._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); }报告组件.html我需要检查列类型是否= 1,然后显示文本处于活动状态的标签,否则显示文本未处于活动状态的标签。文本处于活动状态的预期结果显示标签
1 回答

冉冉说
TA贡献1877条经验 获得超1个赞
这就是你在html中有条件地显示文本的方式,这是你所期望的吗?
<label>{{ReportControl.columnType == 1 ? 'Active' : 'Inactive'}}</label>
用*ngIf
<label *ngIf="ReportControl.columnType == 1">Active</label>
<label *ngIf="ReportControl.columnType == 0">Inactive</label>
添加回答
举报
0/150
提交
取消