Search code examples
angularangular-directiveangular-ng-if

Alternative name for *ngIf directive


A long time ago Angular 2's docs mentioned an alternate name for *ngIf, that didn't use an asterisk. I believe it was something similar to <prefix>-ng-if where <prefix> was some short prefix.

I cannot find any reference to this in the latest docs.

The use case is that the xml parser I am required to use does not support attributes preceded by '*'.


Solution

  • You can use

    <template [ngIf]="expr"></template>
    

    or

    <template bind-ngIf="expr"></template>