如何使用基于角度 6 中的条件隐藏 iframe



我想隐藏我的<iframe></iframe>if(id != 1(。我从查询中获取{{test.id}}id

我是角度新手,我来自 C# 背景,但目前在角度 6 中工作。如何解决此问题。

尝试如下:

<iframe *ngIf="test.id !=1"><iframe>

<ng-container *ngIf="test.id !=1">
<iframe></iframe>
</ng-container>
<iframe *ngIf="test.id !== 1">    
</iframe>

如果不是

<iframe *ngIf="test.id !== 1; else otherContent">    
</iframe>
<ng-template #otherContent>
</ng-template>
<div *ngIf="selectedStudent.schoolId == 29; then ifcondition else elsecondition"></div>
<template #ifcondition>
<iframe id="myIframe" onload="delayedLoad()"></iframe>
</template>
<template #elsecondition>
<span> Else Condition Works!</span>
</template>

这是我的答案,在我的条件下工作。

最新更新