Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Collapse fails to update its height when toggling collapse model #2836

Closed
@mxth

Description

@mxth

I have a simple collapse.

<ul collapse="isCollapsed">
  <li ng-repeat="item in items">
    {{item}}
  </li>
</ul>

Here is the controller:

angular.module('ui.bootstrap.demo').controller('CollapseDemoCtrl', function ($scope) {
  $scope.isCollapsed = true;
  $scope.items = [];
  $scope.add = function() {
    $scope.items.push(Math.random());
  }
});

Plunker: http://plnkr.co/edit/ZYE3A4gt2I3JZgOEXxhf?p=preview

When I toggle the isCollapsed from true to false and add more items to the list, the collapse height is not updated.

The problem is when toggling isCollapsed from true to false, if the list has no item (height: 0px), the collapse will not set the height attribute to auto. Thus, it will make the collapse fail to update its height.

It does not happen when isCollapsed is initialized with false value (still with empty list), since the height attribute is auto in this case.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions