我想顯示/隱藏div元素。所以它會列出一個hopspital,然後當它被點擊時,它應該使用angularjs顯示以下信息。如果我在數據「ng-if =」x.collegeID == returnSchool()「中刪除'ng-repeat =」x,則下拉效果將起作用,但顯然沒有來自我的JSON對象的數據。如果我刪除了'class ='drop-panel animated fadeIn'',那麼你不需要點擊醫院名稱,所有信息都會顯示給你(沒有下拉效果)。我無法弄清楚我做錯了什麼。我只希望能夠點擊醫院名稱,然後將與該醫院相關的信息顯示在其下方。Div無法正確顯示與angularjs
localHospital.html
<!-- resource start -->
<div class="resource" ng-repeat="x in data" ng-if="x.collegeID == returnSchool()">
<!-- resource header & icon -->
<div class="list-item question"><h1><span><img src="{{x.hospitalLogo}}" alt="Timer Icon"></span>{{x.hospitalName}}</h1></div>
<!-- resource data -->
<div class="drop-panel animated fadeIn">
<!-- phone number -->
<p class="resource-title"><img src="img/icons/phone.png" alt="Icon">Phone Number</p>
<a href="tel:{{x.hospitalPhoneNumber}}" target="_blank"><p class="resource-content">{{x.hospitalPhoneNumber}}</p></a>
<!-- location -->
<p class="resource-title"><img src="img/icons/location.png" alt="Icon">Location</p>
<a href="http://maps.google.com/?q={{x.hospitalAddress}}" target="_blank"><p class="resource-content">{{x.hospitalAddress}}</p></a>
<!-- directions -->
<p class="resource-title"><img src="img/icons/link.png" alt="Icon">Directions</p>
<a href="{{x.hospitalDirections}}" target="_blank"><p class="resource-content">{{x.hospitalDirections}}</p></a>
</div>
</div>
<!-- resource end -->
的style.css
.drop-panel {
display: none;
}
.drop-panel.show {
display: block !important;
}
不幸的是,沒有工作 – ndb1995