请帮助,如何在点击第一个元素时进行显示/隐藏,第一个元素将通过使用angularjs ng-show / ng-hide更改为第二个元素?
<div class="panel panel-default" ng-click="showDetails1 = !showDetails1">
<div ng-show="showDetails1">
//this is element 1
</div>
<div ng-click="showDetails2 = !showDetails2">
<div ng-show="showDetails2">
//this is the second element that will appear when the first element is clicked
</div>
</div>
</div>
您可以尝试以下操作,以在隐藏元素1时显示元素2,并在隐藏元素2时显示元素1。
<div class="panel panel-default" ng-init="showDetails =true" ng-click="showDetails = !showDetails">
<div ng-show="showDetails">
//this is element 1
</div>
<div ng-show="!showDetails">
//this is the second element that will appear when the first element is clicked
</div>
</div>
<div class="panel panel-default" ng-click="showDetails1 = !showDetails1">
<div ng-show="showDetails1">
//this is element 1
</div>
<div ng-hide="showDetails1">
//this is the second element that will appear when the first element is clicked
</div>
</div>