Reputation: 181
I want to hide my <iframe></iframe>
if(id != 1).I am getting id from {{test.id}}
which I am getting from a query
I am new in angular, I am from C# background but currently working in angular 6 .How can i resolve this issue.
Upvotes: 0
Views: 1093
Reputation: 1682
<iframe *ngIf="test.id !== 1">
</iframe>
for if else
<iframe *ngIf="test.id !== 1; else otherContent">
</iframe>
<ng-template #otherContent>
</ng-template>
Upvotes: 1
Reputation: 181
<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>
this is my answer and working in my condition.
Upvotes: 0
Reputation: 22203
Try like this:
<iframe *ngIf="test.id !=1"><iframe>
or
<ng-container *ngIf="test.id !=1">
<iframe></iframe>
</ng-container>
Upvotes: 4