Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 默认情况下,控制器中的爱奥尼亚打开手风琴_Angularjs_Ionic - Fatal编程技术网

Angularjs 默认情况下,控制器中的爱奥尼亚打开手风琴

Angularjs 默认情况下,控制器中的爱奥尼亚打开手风琴,angularjs,ionic,Angularjs,Ionic,我使用以下代码实现了爱奥尼亚手风琴效果。正如预期的那样,它工作得很好,但我想默认打开第一个手风琴 <ion-item class="item-stable" ng-click="toggleGroup(0)" ng-class="{active: isGroupShown(0)}"> <i class="icon" ng-class="isGroupShown(0) ? 'ion-min

我使用以下代码实现了爱奥尼亚手风琴效果。正如预期的那样,它工作得很好,但我想默认打开第一个手风琴

    <ion-item class="item-stable"
              ng-click="toggleGroup(0)"
              ng-class="{active: isGroupShown(0)}">
              <i class="icon" ng-class="isGroupShown(0) ? 'ion-minus' : 'ion-plus'"></i>
                    &nbsp;
                        Permanant Address
    </ion-item>

    <div class="item-accordion" ng-show="isGroupShown(0)">
         ---------
    </div>

<ion-item class="item-stable"
              ng-click="toggleGroup(1)"
              ng-class="{active: isGroupShown(1)}">
              <i class="icon" ng-class="isGroupShown(1) ? 'ion-minus' : 'ion-plus'"></i>
                    &nbsp;
                        Temporary Address
    </ion-item>

    <div class="item-accordion" ng-show="isGroupShown(1)">
         ---------
    </div>

只需在for循环的末尾添加这一行:

  $scope.shownGroup = $scope.groups[0];

无法将$scope.shownGroup设置为0以执行此操作吗?我尝试调用$scope.toggleGroup(0);在控制器中,但不工作最好设置一个代码peni已经从这个源代码
  $scope.shownGroup = $scope.groups[0];