*ngIf 指令的替代名称
Alternative name for *ngIf directive
很久以前 Angular 2 的文档提到了 *ngIf
的另一个名称,它没有使用星号。我相信它类似于 <prefix>-ng-if
,其中 <prefix>
是一些短前缀。
我在最新的文档中找不到对此的任何引用。
用例是我需要使用的 xml 解析器不支持以“*”开头的属性。
您可以使用
<template [ngIf]="expr"></template>
或
<template bind-ngIf="expr"></template>
您可以将 template
与 [ngIf]
(与 属性 绑定)一起使用
<template [ngIf]="condition">
<p>
Content Goes here
</p>
</template>
很久以前 Angular 2 的文档提到了 *ngIf
的另一个名称,它没有使用星号。我相信它类似于 <prefix>-ng-if
,其中 <prefix>
是一些短前缀。
我在最新的文档中找不到对此的任何引用。
用例是我需要使用的 xml 解析器不支持以“*”开头的属性。
您可以使用
<template [ngIf]="expr"></template>
或
<template bind-ngIf="expr"></template>
您可以将 template
与 [ngIf]
(与 属性 绑定)一起使用
<template [ngIf]="condition">
<p>
Content Goes here
</p>
</template>