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

Strange behaviour of uib-collapse inside ng-repeat #4885

Closed
BParnikel opened this issue Nov 12, 2015 · 11 comments
Closed

Strange behaviour of uib-collapse inside ng-repeat #4885

BParnikel opened this issue Nov 12, 2015 · 11 comments

Comments

@BParnikel
Copy link

Faced with strange behaviour of uib-collapse inside ng-repeat with changing collection: animations calls with each collection update, despite the fact that uib-collapse is set to false;

See plunkr: http://plnkr.co/edit/rP1AlbLsi1qXuJOJL0D6?p=preview

@BParnikel BParnikel changed the title Strange begavoiur of uib-collapse inside ng-repeat Strange behaviour of uib-collapse inside ng-repeat Nov 12, 2015
@BParnikel BParnikel reopened this Nov 12, 2015
@ghost
Copy link

ghost commented Nov 12, 2015

Maybe related? #4848

@RobJacobs
Copy link
Contributor

Closing as support question answered on SO, link

@BParnikel
Copy link
Author

I got only a partial answer on SO about transition between primitives.
But what about first opening of uib-collapse="false" with animation? I suppose it shouldn't be happened, but it does...

@RobJacobs
Copy link
Contributor

This is a result of the expand animation being run immediately in the link function. Adding the following code:

if (!scope.$eval(attrs.uibCollapse)) {
  element.addClass('in')
    .addClass('collapse')
    .css({height: 'auto'});
} 

at the top of the linking function seems to solve the problem. We should look at why the 'collapse' class is being removed in the expand function. We should be doing something like the collapse function is doing:

if (element.hasClass('collapse') && element.hasClass('in')) {
  return expandDone();
}

Updated plunk with code changes.

@RobJacobs RobJacobs reopened this Nov 12, 2015
@BParnikel
Copy link
Author

Thank you! Is there a chance that this fix will be included in next releases? I think changing of vendor sources is a bad practice :)

@wesleycho
Copy link
Contributor

I wonder if this is related to all of our ngAnimate modal + collapse issues - can you check on whether the fix fixes those issues to @RobJacobs?

@wesleycho wesleycho added this to the 1.0.0 milestone Nov 13, 2015
@RobJacobs
Copy link
Contributor

@wesleycho Will do, wanted to get the positioning PR in first.

@wesleycho
Copy link
Contributor

This is not related to the modal issues - that one turns out to be a gotcha with ng-app needing to be present on the body element or higher.

@wesleycho
Copy link
Contributor

Actually...nevermind, I could be mistaken.

@wesleycho
Copy link
Contributor

So to clarify why the collapse class is removed - Bootstrap uses the collapsing class to set the transition, and the in class to animate.

@BParnikel
Copy link
Author

Great job, @wesleycho, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants