簡體   English   中英

使用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>

這是一個示例:“ Switch”按鈕將切換一個名為switch的布爾變量,並且div將基於該變量的值被隱藏或顯示。

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

<div ng-hide="switch"></div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM