3

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 '*'.

kantianethics
  • 671
  • 5
  • 21

2 Answers2

2

You can use

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

or

<template bind-ngIf="expr"></template>
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
1

You can use template with [ngIf](with Property binding)

<template [ngIf]="condition">
  <p>
    Content Goes here
  </p>
</template>
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299