Search code examples
angularangular-ng-if

why 0 is include in ngIf condition


I was given a project developed by some other developer. He is no more working in this company. When I was going through the code, I saw one line of angular code.

*ngIf=" 0 && test1>120 && test2<900"

can someone tell me why 0 is included in this condition? what is the use of this type of statement?


Solution

  • *ngIf="0" is equivalent to *ngIf="false".

    So, 0 && test1>120 && test2<900 will evaluate to false.

    The *ngIf was probably added to hide dead or experimental code.