2013-12-24 128 views
2

在AngularJS中,我使用了一個bootstrapUI手風琴指令,在其中一個窗格中包含嵌套的手風琴。當父項關閉時,關閉嵌套的UI Bootstrap手風琴

當我關閉'父母'時,我想關閉它的'子女'。我遇到了麻煩,因爲手風琴指令使用的是跨界,而範圍實際上是兄弟姐妹,而不是父母的孩子。

<div ng-controller="AccordionDemoCtrl"> 
    <accordion close-others="oneAtATime"> 
    <accordion-group heading="Static Header"> 
     This content is straight in the template. 
    </accordion-group> 
    <accordion-group heading="{{group.title}}" ng-repeat="group in groups"> 
     {{group.content}} 
    </accordion-group> 
    <accordion-group heading="Nested Accordian"> 
     <accordion close-others="oneAtATime"> 
      <accordion-group heading="Static Header"> 
      This content is straight in the template. 
      </accordion-group> 
      <accordion-group heading="{{group.title}}" ng-repeat="group in groups"> 
      {{group.content}} 
      </accordion-group> 
     </accordion> 
    </accordion-group> 
    </accordion> 
</div> 

Plunker demo

+0

我使用了bootstrapUI源代碼,並通過'id'元素屬性擴展它來跟蹤rootScope中的繼承。這並不像'角度的方式',所以我仍然對另一種方法感興趣。 – randallj

回答