-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: ng-switch with collection-repeat #2078
Comments
if you wrap the list in a separate ion-content that is inside the ng-switch-when, it works fine (set scroll="false" on the top ion-content though, and you'll likely get some other issues that are related to nesting of ion-contents but not to collection-repeat) |
I can confirm this issue, wrapping it inside an ion-content does the job but since we cannot use |
Fixed. The problem was that collection-repeat's logic expected that the scrollView would always get destroyed with the repeater. But there are some situations where you want that scrollView to have a different lifecycle than the repeater. collection-repeat overrides the scrollView's content sizing and onscroll behavior. Now, when it's destroyed, it restores that behavior to normal and resizes the scrollView. |
Type: bug
Platform: all
Having two
collection-repeat
s in the same page with ang-switch
breaks the scroll when "switching". The result is somewhat funny though (when you try to scroll, the items disapear from top to bottom (as they're being redrawn like it is scrolling, but the scroll is absolutelty locked))Plunker here:
http://plnkr.co/edit/MNTJq0QUbRZxiJumoVL9?p=preview
Just scroll a bit to check it works initially, click on "two" (now it doesn't scroll, but there're only 3 elements (as expected)) and when you go back to "one" the bug is clearly visible when you try to scroll down.
I wasn't sure to flag this as a bug or as a documentation thingy, as the docs say:edit: Important update below!
But the thing here is that
ng-switch
doesn't use ng-show/ng-hide, but it just comments out the whole DOM. Maybe you should change the docs to say that there shouldn't be twocollection-repeat
s in the same scrollView at all?In my case there's an easy fix: Put only one collection repeat "pointing" to an array in the scope, and switch this array in the controller depending on which button is pressed. I tried it this way and it works perfectly
(there's then only 1(collection-repeat is not inside an ng-switch)collection-repeat
)EDIT: Just checked what happened in the case where only one tab has collection-repeat, and it's broken as well. Plunker or it didn't happen! http://plnkr.co/edit/Nr2sxcGql3WoRQtNnjMd?p=preview
The text was updated successfully, but these errors were encountered: