【发布时间】:2020-06-25 22:18:01
【问题描述】:
我需要设置title="",只有当我的条件为真时,如果不应该没有title。
所以,只有当property.propertyKey === 'birthday' title 应该得到birthday 值。
<div
*ngFor="let property of visibleCandidateProperties"
[title]="property.propertyKey === 'birthday' ? birthday">
{{candidate[property.propertyKey]}}
</div>
在上面的代码中它不起作用,因为需要添加一些: false 条件。
我该如何重写它?
(也许在.ts文件中重写会更好,而不是.html,但仍然不知道该怎么做)
非常感谢您的帮助!
【问题讨论】:
-
请看我的更新