I am a beginner in AngularJS, and I do not know how to proceed in this case.
I create a panel that can appear and disappear as a variable in the controller, like this:
<div class="toggle-box"> <div ng-click="visivel = !visivel"> Clica! </div> <div ng-show="visivel"> Eu só vou aparecer quando visivel === true </div> </div>
Only I do not know how to do this when there is only one panel. But what if there are multiple?
For example, how could I make all div.toggle-box
have this visibility toggle function?
<div class="toggle-box"> <div ng-click="visivel = !visivel"> Primeiro painel </div> <div ng-show="visivel"> Eu só vou aparecer quando visivel === true </div> </div> <div class="toggle-box"> <div ng-click="visivel = !visivel"> Segundo painel </div> <div ng-show="visivel"> Eu só vou aparecer quando visivel === true </div> </div> ... <div class="toggle-box"> <div ng-click="visivel = !visivel"> Enésimo painel </div> <div ng-show="visivel"> Eu só vou aparecer quando visivel === true </div> </div>