【发布时间】:2019-09-17 13:52:41
【问题描述】:
我查看了类似的问题,但无法完全理解我正在寻找的解决方案。
所以基本上我有这段代码:
<div class="attendees-list__item-order-status course-details-attendees text text-cooler-grey align-self-center pl-3"
[ngClass]="
heading === 'Abrechenbare Buchungen' ? 'col-md-4' : ' col-md-3'
"
>
{{ attendee?.lastName }}, {{ attendee?.firstName }}
</div>
我想修改并添加一个额外的语句。逻辑是如果(heading === 'Abrechenbare Buchungen' 或heading === 'Kürzlich abgerechnete Buchungen')和attendee?.orderStatus == 'CANCELLED',那么它应该将'text--line-through' 类添加到col-md-3 和col-md-4。
我尝试使用"||",正如我在其他类似问题中看到的那样,但找不到有效的解决方案,我很可能没有正确编写语法。
【问题讨论】:
-
我尝试使用
"||",正如我在其他类似问题中看到的那样,但找不到可行的解决方案,我很可能没有正确编写语法。 你能扩展这个?看看您到底尝试了什么并了解它对您不起作用的方式会很有帮助。 -
尝试使用
[class.text--line-through]="heading === 'whatever' || heading === 'otherstuff'"这样的 class.className 版本来添加独立于 ngClass 条件的额外 className。
标签: angular angular-material frontend