angular 4: *ngIf 有多个条件

angular 4: *ngIf with multiple conditions

我有点困惑。如果结果有几种情况之一,我需要隐藏块。但似乎无法正常工作...

<div *ngIf="currentStatus !== 'open' || currentStatus !== 'reopen' ">

    <p padding text-center class="text-notification">{{message}}</p>

</div>

它只是在其他情况下出现的。它对 1 种情况和 2 种情况都不起作用。还尝试了 *ngIf="currentStatus !== ('open' || 'reopen') " 但它仅适用于 1 种情况。

你有一个忍者 ')'。

尝试:

<div *ngIf="currentStatus !== 'open' || currentStatus !== 'reopen'">

除了多余的 ) 之外,此表达式将始终是 true,因为 currentStatus 将始终匹配以下两个条件之一:

currentStatus !== 'open' || currentStatus !== 'reopen'

也许你指的是其中之一

!(currentStatus === 'open' || currentStatus === 'reopen')
(currentStatus !== 'open' && currentStatus !== 'reopen')