Skip to content
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: ionSlideBox inside ionModal initializes incorrectly when active_slide is non-zero #4378

Closed
mixersoft opened this issue Sep 17, 2015 · 2 comments
Milestone

Comments

@mixersoft
Copy link

Type: bug

Platform: all

When using ionSlideBox inside $ionicModal ionSlideBox throws an exception if the active_slide attribute is non-zero, i.e. start on slide 1 ion-slide-box[active_slide="1"]

TypeError: Cannot read property 'length' of undefined
    at circle (ionic.bundle.js:8183)
    at slide (ionic.bundle.js:8212)
    at slide.select (ionic.bundle.js:8565)
    at Object.fn (ionic.bundle.js:58470)
    at Scope.$digest (ionic.bundle.js:24515)
    at Scope.$apply (ionic.bundle.js:24783)
    at HTMLButtonElement.<anonymous> (ionic.bundle.js:57602)
    at HTMLButtonElement.eventHandler (ionic.bundle.js:12103)
    at triggerMouseEvent (ionic.bundle.js:2870)
    at tapClick (ionic.bundle.js:2859)

ionSlideBox evaluates active_slide watch variable BEFOREionic.views.Slider.setup() is complete, so slides.length is invalid. You get an Exception if active_slide is anything but 0

http://codepen.io/anon/pen/xwVRMg?editors=101

click Open Sign-in modal to trigger, and see the JS in SignInModalCtrl

vm.slideCtrl.index=1 triggers the bug.
vm.slideCtrl.index=null avoids the problem by setting active_slide in a $timeout()

@mixersoft mixersoft changed the title ionSlideBox inside ionModal initializes incorrectly when active_slide is non-zero bug: ionSlideBox inside ionModal initializes incorrectly when active_slide is non-zero Sep 17, 2015
@szuzul
Copy link

szuzul commented Sep 29, 2015

+1 for that I'm having the same issue..

@shaoner
Copy link

shaoner commented Nov 30, 2015

same issue here, another workaround is to wait for the modal to show (i.e. having all the slides compiled):

modal.show().then(function () {
   $scope.activeSlide = 1;
});

@mlynch mlynch added this to the 1.2 milestone Dec 6, 2015
@mlynch mlynch closed this as completed in 6061b0a Dec 6, 2015
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants