我在div内有一些html,所有值都通过插值表示。我还使用三元运算符有条件地表达了我的句子的一部分。
{{activity.oxygenFullName}} {{convertStageTypeToText(activity.type)}} {{activity.addedUtc |
date:'short'}} {{activity.type == 'Deployment Scheduled' ? 'to be deployed at ' {{activity.deployment.completedUtc | date: 'short'}} : null}}
尝试将此插值包含在三进制中时,我遇到了大量错误。我正在寻找编写此表达式的正确方法。
答案 0 :(得分:0)
只需在容器上使用ngIf
{{activity.oxygenFullName}} {{convertStageTypeToText(activity.type)}} {{activity.addedUtc |
date:'short'}}
<ng-container *ngIf="activity.type == 'Deployment Scheduled'">
to be deployed at {{activity.deployment.completedUtc | date: 'short'}}
</ng-container>