I am encountering an issue with a div using ngClass and ngIf conditions:
<div [ngClass]="{ 'active': nbActive === 1 }" >
<!-- some stuff -->
</div>
There is also a similar div using a ngIf condition:
<div *ngIf="nbActive === 1">
<!-- some stuff -->
</div>
The declaration for NbActive looks like this:
export class WhyChooseUsComponent implements OnInit {
nbActive: 0;
constructor() { }
// some stuff
}
When I set the production configuration parameters as follows:
"aot": true,
"buildOptimizer": true,
An error occurs stating:
This condition will always return 'false' since the types '0' and '1' have no overlap.
No errors occur when setting aot
and buildOptimizer
to false
. Everything functions as expected in that scenario.
What is causing this issue and how can it be resolved?