角度手风琴 - 扩张崩溃失败 - 没有事件发生

时间:2014-07-15 18:26:21

标签: angularjs angular-ui-bootstrap

我正在尝试打开我的手风琴列表并从按钮关闭,但它不起作用。 关于为什么事件没有解雇的任何想法? 此代码 - >是开放=" $ parent.opened"假设将is-open元素切换为true和ff,从而打开和关闭手风琴元素 感谢

这是我的控制者

  var app = angular.module('app', ['ui.bootstrap']);
    app.controller('programcontroller', ['$scope',function ($scope) {

        $scope.currentPage = 1;

        $scope.opened = true;

        }


    }]); 

这是我的网页身体

<body>
        <div ng-controller="programcontroller">  
            <button class="btn btn-default btn-xs glyphicon-plus" ng-click="togglegroup()">Expand</button>
            <div data-ng-repeat="m in results">
                <div class="container panel-heading">
                    <accordion id="accordion_{{$index+((currentPage-1)*20)+1}}" close-others="false">
                        <accordion-group is-open="$parent.opened">
                            <accordion-heading>
                                {{m.ALabel}} <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': opened, 'glyphicon-chevron-right': !opened}"></i>
                            </accordion-heading>
                            <p>The body of the accordion group grows to fit the contents</p>
                            <button class="btn btn-default btn-sm" ng-click="addItem()">Add Item</button>
                            <div ng-repeat="item in items">{{item}}</div>
                        </accordion-group>
                    </accordion>

                </div>
                <hr />
            </div>
          </div>
    </body>

1 个答案:

答案 0 :(得分:0)

好的,告诉我这是不是你想要的,点击按钮,当标题仍然可见时,正在隐藏身体

<body>
    <div ng-controller="programcontroller">  
        <button class="btn btn-default btn-xs glyphicon-plus"  ng-click="opened = !opened">Expand</button>
        <div data-ng-repeat="m in results">
            <div class="container panel-heading">
                <accordion id="accordion_{{$index+((currentPage-1)*20)+1}}" close-others="false">
                    <accordion-group is-open="$parent.opened">
                        <accordion-heading>
                            {{m.ALabel}} <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': opened, 'glyphicon-chevron-right': !opened}"></i>
                        </accordion-heading>
                        <div  ng-show="opened">
                        <p>The body of the accordion group grows to fit the contents</p>
                        <button class="btn btn-default btn-sm" ng-click="addItem()">Add Item</button>
                        <div ng-repeat="item in items">{{item}}</div>
                        </div>
                    </accordion-group>
                </accordion>

            </div>
            <hr />
        </div>
      </div>
</body>