使用angularjs隐藏/显示div(Hide/show div using angularjs)

编程入门 行业动态 更新时间:2024-10-10 21:25:44
使用angularjs隐藏/显示div(Hide/show div using angularjs)

这是最初隐藏的,在按钮单击时,我想显示表行,而这些行又从WCF服务获取数据。 我是角度新手,所以我无法在按钮点击时显示表格。 它闪烁并消失。

.html snippet <div data-ng-hide="vm1.organizationNumber!=0 && !loading"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12 table-responsive"> <table class="table table-bordered table-condensed table-hover table-striped"> <thead> <tr style="white-space: nowrap;"> <th>Organization #</th> <th>Contract #</th> <th>Plan #</th> <th>Company Name</th> </tr> </thead> <tr> <td>{{vm1.organization}}</td> <td>{{vm1.number}}</td> <td>{{vm1.PlanName}}</td> <td>{{vm1.EmployerName}}</td> </tr> </table> </div> </div> </div> </div>

which is initially hidden, on button click i want to show table rows which in turn get data from WCF service. I am new to angular so i m not able to show the table on button click. it flickers and goes away.

.html snippet <div data-ng-hide="vm1.organizationNumber!=0 && !loading"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12 table-responsive"> <table class="table table-bordered table-condensed table-hover table-striped"> <thead> <tr style="white-space: nowrap;"> <th>Organization #</th> <th>Contract #</th> <th>Plan #</th> <th>Company Name</th> </tr> </thead> <tr> <td>{{vm1.organization}}</td> <td>{{vm1.number}}</td> <td>{{vm1.PlanName}}</td> <td>{{vm1.EmployerName}}</td> </tr> </table> </div> </div> </div> </div>

最满意答案

下面是一个例子:“Switch”按钮将切换一个名为switch的布尔变量,div将根据该变量的值隐藏或显示。

<button ng-click="switch = !switch">switch</button> <div ng-hide="switch"></div>

Here's an example: the "Switch" button will toggle a boolean variable called switch, and the div will be hidden or shown based on the value of that variable.

<button ng-click="switch = !switch">switch</button> <div ng-hide="switch"></div>

更多推荐

本文发布于:2023-08-03 23:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1402382.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:div   angularjs   show   Hide

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!