2017-10-12 101 views
1

我是新來的角度,我正在嘗試在uib-手風琴家中進行ng-repeat。當每個標題被點擊時,後續項目將打開並顯示其用戶。帶ng-repeat的手風琴默認打開的第一個標題

但我想的第一個項目是默認打開的(即第一個項目將被傳遞到擴展(項目)默認情況下)

我曾嘗試是開= $第一。雖然第一個項目是開放的,但用戶不會顯示。

<uib-accordian close-others="oneAtATime"> 
    <div uib-accordian-group class="panel-default" ng-repeat="project in projects"> 
     <uib-accordian-heading><span ng-click="expanded(project)">{{project.name}}</span></uib-accordian-heading> 
      <div ng-repeat="user in project.users"> 
       // 
      </div> 
    </div> 
</uib-accordian> 

回答

0

可以使用是開這樣的:

<uib-accordian close-others="oneAtATime"> 
    <div is-open="($index==0)" uib-accordian-group class="panel-default" ng-repeat="project in projects"> 
     <uib-accordian-heading><span ng-click="expanded(project)">{{project.name}}</span></uib-accordian-heading> 
      <div ng-repeat="user in project.users"> 
       // 
      </div> 
    </div> 
</uib-accordian>