为了账号安全,请及时绑定邮箱和手机立即绑定

如何签入组件.html如果列类型= 1显示标签文本活动否则显示不活动?

如何签入组件.html如果列类型= 1显示标签文本活动否则显示不活动?

隔江千里 2022-08-27 13:56:28
我有对象名称 报告控制 我遇到问题 我无法检查与此对象相关的值如果列类型为 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>


查看完整回答
反对 回复 2022-08-27
  • 1 回答
  • 0 关注
  • 90 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号