Angular 6 ng build --prod error "ERROR Error: ngIfElse must be a TemplateRef, but received 'true'."

For ngIf with else block you need to use <ng-template> block as a else in your .html file.

Here is the sample code:

<div *ngIf="condition; else elseBlock">Content to render when condition is true.</div> <ng-template #elseBlock>Content to render when condition is false.</ng-template>


Issues solved, the cause was a redundant property(Bool) that was attached to the "ng-template"

noData: boolean = true;
<ng-template #noData>...Blah blah...</ng-template>