Search code examples
angulartypescriptangular-ng-if

NgIf does not work with undefined


I want to display message with usage of ngIf:

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

It seems very strange, because it does not work although after each change on the select list, I am logging in the console:

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

and it returns true.

I am using the Angular 4.4.4.


Solution

  • I came to a solution. I had in the form the control with such a name. Because of that there was the conflict