I am using Angular 2 and would like to check if a variable value is undefined
using the htm *ngIf
condition.
If I use <span *ngIf="!testvar">
, it also covers the case when variable testvar = 0
, but I would like to exclude the case when it is 0.
The following works, but those are 2 checks:
<span *ngIf="!testvar && testvarl != 0"></span>
I would like to check this case with only condition to shorten it and make it cleaner.
Is there a simple way to do this?
*ngIf="testvar != undefined"
– Pulmonary