1
People need to click on each BTN open a content with information, in the example each click open the 3 contents, how to make dynamic this click and each button open its content, open one at a time, similar to a tooltip behavior.
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.abreConteudo = false;
$scope.funcaoClicar = function() {
$scope.abreConteudo = true;
};
});
.box {
margin-top: 50px;
display: inline-block;
min-width: 80px;
}
<html lang="pt" ng-app="myApp">
<body ng-controller="myCtrl">
<section class="box">
<button ng-click="funcaoClicar()">Botão 1</button>
<div ng-show="abreConteudo">Conteúdo 1</div>
</section>
<section class="box">
<button>Botão 2</button>
<div ng-show="abreConteudo">Conteúdo 2</div>
</section>
<section class="box">
<button>Botão 3</button>
<div ng-show="abreConteudo">Conteúdo 3</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
</body>
</html>
Samuel, what behavior do you expect when I open one piece of content and click another? I keep the first open, or want to show only one content at a time?
– Pedro Camara Junior
The behavior is to open one at a time, if open the first the others are closed.
– Samuel Souza