angularjs

Angular accordion: animate toggle


Can someone advice how to do accordion that toggles with animation and if I click on 1st div, only the 1st panel will show? http://plnkr.co/edit/LdBVT0zbYdshITwr3qjh?p=preview


Solution

  •   <body ng-controller="Ctrl">
        <div ng-repeat="item in items">
          <div class="accordion" ng-click="show=show==true? false:true;">
            {{item.id}}
          </div>
          <div class="repeated-item" ng-model="accordionContent" ng-show="show">
            {{item.name}}
          </div>
        </div>
      </body>
    

    You don't need controller for this purpose, it can be handled directly using directives Plunker Demo