这是次要的,但我不知道我的生活会弄清楚发生了什么......所以
我有一个内联if语句,如此...
<button *ngIf="item?.fields?.assetType !== 'tool' || item?.fields?.assetType !== 'questions'">NEXT</button>
所以基本上功能是..如果返回的数据有assetType
tool
或questions
没有显示按钮..现在行为可以正常工作返回的assetType
tool
按钮被隐藏但是当我获得assetType
等于questions
的数据时按钮仍会显示..
这里是正在返回的数据...正如您所看到的那样assetType
等于questions
所以..按钮应该被隐藏但是它不是
我确定这个问题很小我只是想弄清楚, 任何帮助将不胜感激!
答案 0 :(得分:1)
对于assetType&#34;问题&#34;在上面的例子中,让我们来看看它:
item?.fields?.assetType!==&#39; tool&#39;的 TRUE 强>
item?.fields?.assetType!==&#39;问题&#39;的 FALSE 强>
语句将评估为 TRUE ,因为它是一个逻辑OR。