* ngIf指令的替代名称

问题描述 投票:3回答:2

很久以前,Angular 2的文档提到了*ngIf的替代名称,它没有使用星号。我相信它与<prefix>-ng-if类似,其中<prefix>是一些短前缀。

我在最新的文档中找不到任何引用。

用例是我需要使用的xml解析器不支持以'*'开头的属性。

angular angular-directive angular-ng-if
2个回答
2
投票

您可以使用

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

要么

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

1
投票

你可以使用template[ngIf](带属性绑定)

<template [ngIf]="condition">
  <p>
    Content Goes here
  </p>
</template>
© www.soinside.com 2019 - 2024. All rights reserved.