Close a Collapse when opening another using AngularJS UI

2

I have a collapse and another one on the side, I wanted to click on one, close the other if it was open.

My html code:

angular.module("seuCondominio", ['ui.bootstrap']);
angular.module("seuCondominio").controller("seuCondominioCtrl", function($scope) {
  $scope.isCollapsed = true;
  $scope.isCollapsededit = true;
  $scope.tarefas = [{
    id: 0,
    nome: "Lavar alguma coisa",
    inicio: "10/10/10",
    conclusao: "11/10/10",
    custo: "1000",
    status: {
      nome: "Concluído"
    }
  }]
});
<html ng-app="seuCondominio">

<head>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js"></script>
  <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.0.js"></script>
  <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>

<body ng-controller="seuCondominioCtrl">

  <div id="editar">
    <button id="lapis" class="btn btn-default" ng-click="isCollapsededit = !isCollapsededit">Simbolo</span>
    </button>

    <button class="btn btn-default" ng-click="isCollapsed = !isCollapsed"><span class="glyphicon glyphicon-chevron-right"></span>{{' ' + tarefas[0].nome}}</button>
    <div collapse="isCollapsededit" style="position:relative">
      Conteudo 1
    </div>
  </div>
  <div collapse="isCollapsed" style="position:relative">
    Conteudo 2
  </div>
  </div>

</html>
</body>
So I wanted it somehow, when I clicked on one, the other would close.     
asked by anonymous 22.07.2015 / 22:07

1 answer

0

I discovered that I can use more than one command in ng-click using ";", so I put

ng-click="acc1 = !acc1; acc2 = true

and

ng-click="acc2 = acc2; acc1 = true

on buttons and worked

Thanks for your help!

    
23.07.2015 / 12:16