admin管理员组文章数量:1336396
I would show message depending on a 2 values
<div *ngIf="nolimit; else limited">
<p class="isGroup">No limit message</p>
</div>
<div *ngIf="noDelegation; else limited">
<p class="isGroup">No delegation</p>
</div>
<ng-template #limited>
Content here
</ng-template>
I would that either isGroup
message shows or no delegation
if they are both false I should show content #limited
My actual problem is that I get no limit message and #limited
content together when nolimit
is true:
no limit
Content Here
But When I delete no delegation
code, evetything is working.
I would show message depending on a 2 values
<div *ngIf="nolimit; else limited">
<p class="isGroup">No limit message</p>
</div>
<div *ngIf="noDelegation; else limited">
<p class="isGroup">No delegation</p>
</div>
<ng-template #limited>
Content here
</ng-template>
I would that either isGroup
message shows or no delegation
if they are both false I should show content #limited
My actual problem is that I get no limit message and #limited
content together when nolimit
is true:
no limit
Content Here
But When I delete no delegation
code, evetything is working.
-
1
Why not creating three divs and then using
*ngIf="!nolimit && !noDelegation"
on the last one that will showContent here
text – SiddAjmera Commented Sep 17, 2018 at 17:27
2 Answers
Reset to default 5It would be better to use three div
s and then use *ngIf="!nolimit && !noDelegation"
on the last one that will show Content here
text
<div>
<div *ngIf="nolimit">
<p class="isGroup">No limit message</p>
</div>
<div *ngIf="noDelegation">
<p class="isGroup">No delegation</p>
</div>
</div>
<div *ngIf="!nolimit && !noDelegation">
Content here
</div>
I think it has to do with the microsintax:
<div [ngIf]="nolimit" [ngIfElse]="limited">
<p class="isGroup">No limit message</p>
</div>
<div [ngIf]="noDelegation" [ngIfElse]="limited">
<p class="isGroup">No delegation</p>
</div>
<ng-template #limited>
Content here
</ng-template>
本文标签: javascriptngIf else if in AngularStack Overflow
版权声明:本文标题:javascript - ngIf else if in Angular - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742332040a2454887.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论