错误与否?手风琴在0.7.0上无法正常工作

时间:2013-12-09 21:56:10

标签: angularjs twitter-bootstrap accordion

我正在努力做正常的事情:用第一个元素打开手风琴。

  <accordion close-others="true">
  <accordion-group ng-repeat="group in groups" is-open="$first">
    <accordion-heading>
      {{group.title}} <i class="pull-right" ng-class="{'icon-chevron-down': isopen, 'icon-chevron-right': !isopen}"></i>
    </accordion-heading>
    <div ng-repeat="item in group.content">{{item.title}}</div>
  </accordion-group>
</accordion>

is-open =“$ first”几乎解决了这个问题,

已更新

<击> http://plnkr.co/edit/CODNWD7WiBHDfYHHuK7C?p=preview
http://plnkr.co/edit/4jYuw2?p=preview

但是看看icon-chevron - 它仍然是下降的。当我点击它 - 它会展开并折叠,但图标仍然会停止...

1 个答案:

答案 0 :(得分:0)

我克隆了你的plunkr,它有两个变化: http://plnkr.co/edit/1IHE5lRmm0oZzeHekkkZ?p=preview

在这里,您可以看到您的代码现在的样子:

<accordion close-others="true">
  <accordion-group ng-repeat="group in groups" is-open="group.open">
    <accordion-heading>
      {{group.title}} <i class="pull-right" ng-class="{'icon-chevron-down': group.open, 'icon-chevron-right': !group.open}"></i>
    </accordion-heading>
    <div ng-repeat="item in group.content">{{item.title}}</div>
  </accordion-group>
</accordion>

这样,您将默认打开第一个标签并使用已打开的图标。