NgIf 不适用于 undefined

NgIf does not work with undefined

我想使用 ngIf 显示消息:

<div *ngIf="airplaneType === undefined" class="error">
     Choose correct airplane from the list!
 </div> 

这看起来很奇怪,因为它不起作用,尽管在 select 列表上每次更改后,我都会登录控制台:

console.log(this.airplaneType === undefined);

它 returns 正确。

我正在使用 Angular 4.4.4.

这样做:

<div [class.error]="airplaneType === undefined">
     Choose correct airplane from the list!
</div>

我找到了解决办法。我在表格中有这样一个名字的控件。因此发生了冲突