Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Operator '==' cannot be applied to types 'number' and 'string'

I'm getting this error while I compile my code with --aot. without --aot it ignores this error.

here is the line on which I'm getting this error

<h2 class="inquiry-title" *ngIf="(summaryData.Title != undefined || summaryData.Title != null)">
    {{summaryData.Title}}
</h2>

Please suggest me what I'm doing wrong?

like image 257
Nikhil Radadiya Avatar asked Jun 07 '26 14:06

Nikhil Radadiya


1 Answers

undefined and null are all falsy in javascript, you have just to do:

<h2 class="inquiry-title" *ngIf="summaryData.Title">
    {{summaryData.Title}}
</h2>
like image 144
Faly Avatar answered Jun 09 '26 05:06

Faly