这很小,但我不知道发生了什么.所以
我有这样的内联if语句..。
<button *ngIf="item?.fields?.assetType !== 'tool' || item?.fields?.assetType !== 'questions'">NEXT</button>基本上功能是..。如果返回的数据具有assetType of tool或questions,则不要显示按钮。现在,当返回的数据具有assetType of tool时,行为就会正常工作,按钮是隐藏的,但是当我得到assetType等于questions的数据时,按钮仍然出现。
这是正在返回的数据..。如您所见,assetType等于questions,所以。这个按钮应该是隐藏的,但它不是

我确信这个问题是很小的,我就是想不出,任何帮助都会很感激!
发布于 2018-03-19 00:35:17
对于上面示例中的assetType“问题”,让我们来看一看:
item?.fields?.assetType !== 'tool‘TRUE
item?.fields?.assetType !==的问题“FALSE”
语句将计算为TRUE,因为这是一个逻辑OR。
https://stackoverflow.com/questions/49354190
复制相似问题